Skip to content

False positive unfulfilled_lint_expectations for enum_glob_use with --all-targets or --tests #13358

Open
@lnicola

Description

@lnicola

Summary

unfulfilled_lint_expectations seems to trigger for enum_glob_use when either --all-targets or --tests is used. Yet other lints, like unreadable_literal don't behave that way.

rust-lang/rust#130021
rust-lang/rust-analyzer#17685

Lint Name

enum_glob_use

Reproducer

I tried this code:

#![warn(clippy::pedantic)]

#[expect(clippy::enum_glob_use)]
use std::cmp::Ordering::*;

fn main() {
    #[expect(clippy::unreadable_literal)]
    let _ = 1000000000;
    print!("{Equal:?}");
}

I saw this happen:

$ cargo clippy --all-targets
warning: this lint expectation is unfulfilled
 --> src/main.rs:3:10
  |
3 | #[expect(clippy::enum_glob_use)]
  |          ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unfulfilled_lint_expectations)]` on by default

warning: `hello` (bin "hello" test) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s

I expected to see this happen:

$ cargo clippy
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s

Version

rustc 1.81.0-beta.6 (b5fd9f6f1 2024-08-21)
binary: rustc
commit-hash: b5fd9f6f1061b79c045cc08fe03e00caad536800
commit-date: 2024-08-21
host: x86_64-unknown-linux-gnu
release: 1.81.0-beta.6
LLVM version: 18.1.7

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions