Skip to content

Commit

Permalink
Avoid boxing
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtn committed Dec 22, 2020
1 parent 1a9dcd3 commit 1c1193a
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 1c1193a

Please sign in to comment.