Skip to content

#[expect(...)] doen't catch lints from different check_* function #97660

Closed
@Jarcho

Description

@Jarcho

Some lints are emitted from a from a different from the area they are linted. e.g. clippy::ptr_arg is linting from check_body, but it can be allowed from the argument (fn foo(#[allow(clippy::ptr_arg)] x: &Vec<u32>) {}).

The following lints in clippy (and probably more) lint from different check_* functions:

  • needless_borrow
  • ref_binding_to_ref
  • duplicate_mod
  • multiple_inherent_impl
  • macro_use_imports
  • manual_non_exhaustive
  • same_name_method
  • async_yields_async
  • await_holding_lock
  • await_holding_refcell
  • await_holding_invalid_type
  • default_numeric_fallback
  • ptr_arg
  • redundant_clone
  • logic_bug
  • nonminimal_bool
  • boxed_local
  • implicit_return
  • needless_return
  • unnecessary_unwrap
  • panicking_unwrap

Some of these don't actually work with allow at a narrower scope either, but some of them check to see if the lint has been allowed on the target item before emitting the lint.

cc #54503

Metadata

Metadata

Assignees

Labels

A-clippyArea: ClippyC-bugCategory: This is a bug.F-lint_reasons`#![feature(lint_reasons)]`

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions