Skip to content

Commit

Permalink
Use built-in NullabilityInfoContext when available
Browse files Browse the repository at this point in the history
  • Loading branch information
dstelljes committed Sep 11, 2023
1 parent 9cd1650 commit 4074214
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Chr.Avro/Abstract/RecordSchemaBuilderCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ namespace Chr.Avro.Abstract
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using Chr.Avro.Infrastructure;
#if !NET6_0_OR_GREATER
using NullabilityInfoContext = Chr.Avro.Infrastructure.NullabilityInfoContext;
using NullabilityState = Chr.Avro.Infrastructure.NullabilityState;
using NullabilityInfo = Chr.Avro.Infrastructure.NullabilityInfo;

Check warning on line 15 in src/Chr.Avro/Abstract/RecordSchemaBuilderCase.cs

View workflow job for this annotation

GitHub Actions / Run library tests (net462, windows-latest)

Using alias directive for 'NullabilityInfo' should appear before using alias directive for 'NullabilityInfoContext' (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1211.md)

#endif

/// <summary>
/// Implements a <see cref="SchemaBuilder" /> case that matches any non-array or non-primitive
Expand Down
2 changes: 2 additions & 0 deletions src/Chr.Avro/Infrastructure/NullabilityInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !NET6_0_OR_GREATER
namespace Chr.Avro.Infrastructure
{
using System;
Expand Down Expand Up @@ -70,3 +71,4 @@ internal NullabilityInfo(
public NullabilityInfo[] GenericTypeArguments { get; }
}
}
#endif
2 changes: 2 additions & 0 deletions src/Chr.Avro/Infrastructure/NullabilityInfoContext.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !NET6_0_OR_GREATER
namespace Chr.Avro.Infrastructure
{
using System;
Expand Down Expand Up @@ -572,3 +573,4 @@ public bool ParseNullableState(int index, ref NullabilityState state)
}
}
}
#endif
2 changes: 2 additions & 0 deletions src/Chr.Avro/Infrastructure/NullabilityState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !NET6_0_OR_GREATER
namespace Chr.Avro.Infrastructure
{
/// <summary>
Expand Down Expand Up @@ -26,3 +27,4 @@ internal enum NullabilityState
Nullable,
}
}
#endif

0 comments on commit 4074214

Please sign in to comment.