Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove ToList calls that seem superfluous.
  • Loading branch information
MartyIX committed Sep 5, 2021
commit 276187a9ea4f0e0021e0c671d3eaeb6ed9af94a3
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ protected override void InitializeWorker(CompilationStartAnalysisContext context

if (!oaContext.Options.IsConfiguredToSkipAnalysis(iformatProviderAlternateRule, targetMethod, oaContext.ContainingSymbol, oaContext.Compilation))
{
IEnumerable<IMethodSymbol> methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType<IMethodSymbol>().WhereMethodDoesNotContainAttribute(obsoleteAttributeType).ToList();
IEnumerable<IMethodSymbol> methodsWithSameNameAsTargetMethod = targetMethod.ContainingType.GetMembers(targetMethod.Name).OfType<IMethodSymbol>().WhereMethodDoesNotContainAttribute(obsoleteAttributeType);
if (methodsWithSameNameAsTargetMethod.HasMoreThan(1))
{
var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, iformatProviderType).ToList();
var correctOverloads = methodsWithSameNameAsTargetMethod.GetMethodOverloadsWithDesiredParameterAtLeadingOrTrailing(targetMethod, iformatProviderType);

// If there are two matching overloads, one with CultureInfo as the first parameter and one with CultureInfo as the last parameter,
// report the diagnostic on the overload with CultureInfo as the last parameter, to match the behavior of FxCop.
Expand Down