From 1c1193a51e9be5b613963d83d97ea5a53ca01519 Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Thu, 5 Mar 2020 00:00:00 +0800 Subject: [PATCH] Avoid boxing --- .../SA1114ParameterListMustFollowDeclaration.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1114ParameterListMustFollowDeclaration.cs b/StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1114ParameterListMustFollowDeclaration.cs index 02069de88..3f1222394 100644 --- a/StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1114ParameterListMustFollowDeclaration.cs +++ b/StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1114ParameterListMustFollowDeclaration.cs @@ -5,12 +5,10 @@ namespace StyleCop.Analyzers.ReadabilityRules { using System; using System.Collections.Immutable; - using System.Linq; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; - using StyleCop.Analyzers.Helpers; using StyleCop.Analyzers.Lightup; /// @@ -311,7 +309,16 @@ private static bool SpanMultipleLines(SyntaxToken startToken, SyntaxNode endNode static int EndOfLineTriviaCount(SyntaxTriviaList list) { - return list.Count(trivia => trivia.IsKind(SyntaxKind.EndOfLineTrivia)); + int count = 0; + foreach (var trivia in list) + { + if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) + { + count++; + } + } + + return count; } } }