Skip to content

Commit

Permalink
RedundantBraces: keep brace after a semicolon
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 15, 2024
1 parent 0f88ed5 commit 663dc82
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,13 @@ class RedundantBraces(implicit val ftoks: FormatTokens)
case _ => false
}
val ok = ft.meta.rightOwner match {
case _: Term.Block => !braceSeparatesTwoXmlTokens &&
case t: Term.Block => !braceSeparatesTwoXmlTokens &&
(ftoks.prevNonComment(ft) match {
case FormatToken(_: Token.Semicolon, _, m) =>
val plo = m.leftOwner
(plo eq t) || !plo.parent.contains(t)
case _ => true
}) &&
(style.dialect.allowSignificantIndentation ||
okComment(ft) && !elseAfterRightBraceThenpOnLeft)
case _ => true
Expand Down

0 comments on commit 663dc82

Please sign in to comment.