Skip to content

False Positive unfulfilled_lint_expectations #159323

Description

@LambdaAlpha

I tried this code:

pub struct A {
    #[expect(non_snake_case)]
    pub direction_L: bool,
}

play

I expected to see this happen: cargo clippy outputs no warnings.

Instead, this happened: cargo clippy outputs 2 warnings, 1. non_snake_case 2. unfulfilled_lint_expectations

warning: structure field `direction_L` should have a snake case name
 --> src/lib.rs:3:9
  |
3 |     pub direction_L: bool,
  |         ^^^^^^^^^^^ help: convert the identifier to snake case: `direction_l`
  |
  = note: `#[warn(non_snake_case)]` (part of `#[warn(nonstandard_style)]`) on by default

warning: this lint expectation is unfulfilled
 --> src/lib.rs:2:14
  |
2 |     #[expect(non_snake_case)]
  |              ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unfulfilled_lint_expectations)]` on by default

Meta

rustc --version --verbose:

1.97.0

The bug also exists in the beta and nightly versions.

Backtrace

<backtrace>

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions