Skip to content

Extractions still being linted in unnecessary_lambda_linter() with explicit return #2258

@MichaelChirico

Description

@MichaelChirico
lint("
  sapply(
    x,
    function(xi) {
      return(foo(xi)$bar)
    }
  )
", unnecessary_lambda_linter())
# <text>:4:5: warning: [unnecessary_lambda_linter] Pass foo directly as a symbol to sapply() instead of wrapping it in an unnecessary anonymous function. For example, prefer lapply(DF, sum) to lapply(DF, function(x) sum(x)).
#     function(xi) {
#     ^~~~~~~~~~~~~~```

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but doesregressioncode that used to work, but now doesn't

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions