Skip to content

Commit a486a75

Browse files
authored
Simplify NameFixProvider (#6268)
1 parent cd84abe commit a486a75

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

tools-local/Microsoft.ML.InternalCodeAnalyzer/NameFixProvider.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public sealed class NameFixProvider : CodeFixProvider
3434
private static ImmutableArray<string> _fixable = ImmutableArray.Create(
3535
NameAnalyzer.PrivateFieldName.Id, NameAnalyzer.GeneralName.Id,
3636
ParameterVariableNameAnalyzer.Id, TypeParamNameAnalyzer.Id);
37-
private static readonly ImmutableHashSet<string> _fixableSet = ImmutableHashSet<string>.Empty.Union(_fixable);
3837

3938
private static readonly Regex _sections = new Regex(
4039
@"(?:\p{Nd}\p{Ll}*)|" + // Numbers we consider a separate token.
@@ -49,9 +48,7 @@ public override FixAllProvider GetFixAllProvider()
4948

5049
public override async Task RegisterCodeFixesAsync(CodeFixContext context)
5150
{
52-
var diagnostic = context.Diagnostics.FirstOrDefault(d => _fixableSet.Contains(d.Id));
53-
if (diagnostic == null)
54-
return;
51+
var diagnostic = context.Diagnostics[0];
5552

5653
string originalName = diagnostic.Properties[NameAnalyzer.NameProperty];
5754
string desiredNameStr = diagnostic.Properties[NameAnalyzer.DesiredNameProperty];

0 commit comments

Comments
 (0)