Skip to content
This repository was archived by the owner on Jul 12, 2022. It is now read-only.

Commit 26c1f35

Browse files
author
Lakshmi Priya Sekar
committed
Fix bug
1 parent 290fbc3 commit 26c1f35

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.DotNet.CodeFormatting/Rules/HasNoNewLineBeforeEndBraceFormattingRule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ private static IEnumerable<SyntaxTrivia> RemoveNewLinesFromTop(IEnumerable<Synta
5656

5757
private static IEnumerable<SyntaxTrivia> RemoveNewLinesFromBotton(IEnumerable<SyntaxTrivia> trivia)
5858
{
59-
int elementsToRemoveAtEnd = trivia.Count() - 2;
6059
bool addWhitespace = false;
6160
if (trivia.Count() > 1 && trivia.Last().CSharpKind() == SyntaxKind.WhitespaceTrivia)
6261
{
6362
addWhitespace = true;
6463
trivia = trivia.Take(trivia.Count() - 1);
6564
}
6665

66+
int elementsToRemoveAtEnd = trivia.Count() - 1;
67+
6768
if (trivia.Any() && trivia.Last().CSharpKind() == SyntaxKind.EndOfLineTrivia)
6869
{
6970
if (trivia.Count() > 1)

0 commit comments

Comments
 (0)