Originally posted by @AshesITR in #2302 (comment)
Test case for switch():
test_that("unnecessary_nesting_linter skips one-expression switch statements", {
expect_lint(
trim_some("
switch(x,
a = {
do_a()
},
b = {
do_b()
}
)
"),
NULL,
unnecessary_nesting_linter()
)
})
Hint at implementation:
or self::expr/SYMBOL_FUNCTION_CALL[text() = 'switch']
See also #2326