Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Jun 17, 2020
1 parent f52e88c commit 513a1c6
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private static async Task<ImmutableArray<AddImportFixData>> GetUnambiguousFixesA
.GetFixesForDiagnosticsAsync(document, diagnosticsForSourceSpan.Key, diagnosticsForSourceSpan.AsImmutable(),
maxResultsPerDiagnostic: 2, symbolSearchService, searchReferenceAssemblies: true, packageSources, cancellationToken));

var fixes = ArrayBuilder<AddImportFixData>.GetInstance();
using var _ = ArrayBuilder<AddImportFixData>.GetInstance(out var fixes);
foreach (var getFixesForDiagnosticsTask in getFixesForDiagnosticsTasks)
{
var fixesForDiagnostics = await getFixesForDiagnosticsTask.ConfigureAwait(false);
Expand All @@ -112,13 +112,11 @@ private static async Task<ImmutableArray<AddImportFixData>> GetUnambiguousFixesA
// fix this diagnostic and instead leave it for the user to resolve since they
// will have more context for determining the proper fix.
if (fixesForDiagnostic.Fixes.Length == 1)
{
fixes.Add(fixesForDiagnostic.Fixes[0]);
}
}
}

return fixes.ToImmutableAndFree();
return fixes.ToImmutable();
}

private static async Task<Document> ApplyFixesAsync(Document document, ImmutableArray<AddImportFixData> fixes, CancellationToken cancellationToken)
Expand Down

0 comments on commit 513a1c6

Please sign in to comment.