Skip to content

Commit acb31ca

Browse files
reformulate to also cover strict = FALSE
1 parent 7586501 commit acb31ca

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

R/rules-line-breaks.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,12 @@ style_line_break_around_curly <- function(strict, pd) {
156156
opening_before <- (pd$token == "'{'")
157157
to_break <- lag(opening_before, default = FALSE) | closing_before
158158
len_to_break <- sum(to_break)
159-
pd$lag_newlines[to_break] <- ifelse(rep(strict, len_to_break),
160-
ifelse(pd$token[to_break] == "COMMENT", pmin(1L, pd$lag_newlines[to_break]), 1L),
161-
pmax(1L, pd$lag_newlines[to_break])
159+
pd$lag_newlines[to_break] <- ifelse(
160+
pd$token[to_break] == "COMMENT",
161+
{
162+
if (strict) pmin else pmax
163+
}(1L, pd$lag_newlines[to_break]),
164+
1L
162165
)
163166
} else {
164167
is_else <- pd$token == "ELSE"

0 commit comments

Comments
 (0)