Skip to content

Commit c3ae121

Browse files
committed
Avoid mutations if the result will match the input
1 parent 38ab7d3 commit c3ae121

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1137ElementsShouldHaveTheSameIndentation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private static void CheckElements<T>(SyntaxNodeAnalysisContext context, Immutabl
362362
// Try to reorder the list so the first item is not an attribute list. This element will establish the
363363
// expected indentation for the entire collection.
364364
int desiredFirst = elements.FindIndex(x => !x.IsKind(SyntaxKind.AttributeList));
365-
if (desiredFirst >= 0)
365+
if (desiredFirst > 0)
366366
{
367367
T newFirstElement = elements[desiredFirst];
368368
elements = elements.RemoveAt(desiredFirst).Insert(0, newFirstElement);

0 commit comments

Comments
 (0)