Compare
code <- "foo <- function(x) {
x + 1
}"
writeLines(code)
#> foo <- function(x) {
#> x + 1
#> }
lintr::lint(
text = code,
linters = lintr::unnecessary_nesting_linter()
)
#> ℹ No lints found.
Created on 2025-02-13 with reprex v2.1.1
vs.
code <- "foo <- \\(x) {
x + 1
}"
writeLines(code)
#> foo <- \(x) {
#> x + 1
#> }
lintr::lint(
text = code,
linters = lintr::unnecessary_nesting_linter()
)
#> <text>:1:13: warning: [unnecessary_nesting_linter] Reduce the nesting of this statement by removing the braces {}.
#> foo <- \(x) {
#> ^
Created on 2025-02-13 with reprex v2.1.1
Linting this case should be the responsibility of #2240, instead.