Skip to content

Commit

Permalink
fixup minor reported diagnostics (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgravell authored Dec 13, 2023
1 parent 636fd63 commit 3bd3504
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Dapper.AOT.Analyzers/CodeAnalysis/Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ private static DiagnosticDescriptor Create(string id, string title, string messa

protected static DiagnosticDescriptor LibraryInfo(string id, string title, string messageFormat) => Create(id, title, messageFormat, Category.Library, DiagnosticSeverity.Info);

protected static DiagnosticDescriptor SqlWarning(string id, string title, string messageFormat, bool docs = true) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Warning);
protected static DiagnosticDescriptor SqlWarning(string id, string title, string messageFormat) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Warning);

protected static DiagnosticDescriptor SqlError(string id, string title, string messageFormat, bool docs = true) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Error);
protected static DiagnosticDescriptor SqlError(string id, string title, string messageFormat) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Error);

protected static DiagnosticDescriptor SqlInfo(string id, string title, string messageFormat, bool docs = true) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Info);
protected static DiagnosticDescriptor SqlInfo(string id, string title, string messageFormat) => Create(id, title, messageFormat, Category.Sql, DiagnosticSeverity.Info);

protected static DiagnosticDescriptor PerformanceWarning(string id, string title, string messageFormat) => Create(id, title, messageFormat, Category.Performance, DiagnosticSeverity.Warning);

Expand Down
2 changes: 1 addition & 1 deletion src/Dapper.AOT/TypeAccessor.AccessorDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public AccessorDataReader(TypeAccessor<T> accessor, string[]? members, bool exac
int[] tokens;
if (members is null || members.Length == 0)
{
_tokens = tokens = accessor.MemberCount == 0 ? Array.Empty<int>() : new int[accessor.MemberCount];
_tokens = tokens = accessor.MemberCount == 0 ? [] : new int[accessor.MemberCount];
for (int i = 0; i < tokens.Length; i++)
{
tokens[i] = i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ public BulkInsertIntegrationTests(SqlClientFixture fixture)

public void Dispose() => _connection?.Dispose();

IEnumerable<Foo> GenerateRows(int count)
static IEnumerable<Foo> GenerateRows(int count)
{
for (int i = 0; i < count; i++)
{
yield return new Foo { Id = i, Name = $"row {i}" };
}
}

async IAsyncEnumerable<Foo> GenerateRowsAsync(int count)
static async IAsyncEnumerable<Foo> GenerateRowsAsync(int count)
{
for (int i = 0; i < count; i++)
{
Expand Down Expand Up @@ -96,7 +96,7 @@ await table.WriteToServerAsync(TypeAccessor.CreateDataReader(GenerateRowsAsync(1
internal class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public string Name { get; set; } = null!;
}
}

Expand Down

0 comments on commit 3bd3504

Please sign in to comment.