Skip to content

Commit

Permalink
Remove redundant [DisallowNull] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
firenero committed Apr 14, 2024
1 parent c58e8ce commit 2e6eded
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace FastIDs.TypeId.Serialization.SystemTextJson;
Expand All @@ -17,7 +16,7 @@ public override void Write(Utf8JsonWriter writer, TypeId value, JsonSerializerOp
writer.WriteStringValue(value.ToString());
}

public override void WriteAsPropertyName(Utf8JsonWriter writer, [DisallowNull] TypeId value, JsonSerializerOptions options)
public override void WriteAsPropertyName(Utf8JsonWriter writer, TypeId value, JsonSerializerOptions options)
{
writer.WritePropertyName(value.ToString());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace FastIDs.TypeId.Serialization.SystemTextJson;
Expand All @@ -26,7 +25,7 @@ public override TypeIdDecoded ReadAsPropertyName(ref Utf8JsonReader reader, Type
return ReadTypeId(ref reader);
}

public override void WriteAsPropertyName(Utf8JsonWriter writer, [DisallowNull] TypeIdDecoded value, JsonSerializerOptions options)
public override void WriteAsPropertyName(Utf8JsonWriter writer, TypeIdDecoded value, JsonSerializerOptions options)
{
var totalLength = value.Type.Length + 1 + 26;
Span<char> buffer = stackalloc char[totalLength];
Expand All @@ -42,7 +41,7 @@ private static TypeIdDecoded ReadTypeId(ref Utf8JsonReader reader)
return val is not null ? TypeId.Parse(val).Decode() : default;
}

private static void CopyValueToBuffer(TypeIdDecoded value, Span<char> buffer)
private static void CopyValueToBuffer(in TypeIdDecoded value, Span<char> buffer)
{
value.Type.AsSpan().CopyTo(buffer);
buffer[value.Type.Length] = '_';
Expand Down

0 comments on commit 2e6eded

Please sign in to comment.