# will produce lints
lint(
text = "lapply(list(1:3, 2:4), function(xi) sum(xi))",
linters = unnecessary_lambda_linter()
)
# okay
lint(
text = "lapply(list(1:3, 2:4), sum)",
linters = unnecessary_lambda_linter()
)
lint(
text = 'lapply(x, function(xi) grep("ptn", xi))',
linters = unnecessary_lambda_linter()
)
lint(
text = "lapply(x, function(xi) data.frame(col = xi))",
linters = unnecessary_lambda_linter()
)
Run the code above in your browser using DataLab