Skip to content

False positive unfulfilled_lint_expectations with either of --tests or --all-targets #130021

Closed
@lnicola

Description

@lnicola

Code

//! crate docs

#![warn(missing_docs)]
#![warn(clippy::pedantic)]

#[expect(missing_docs)]
pub fn foo() {}

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

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

Current output

$ cargo check --all-targets
warning: this lint expectation is unfulfilled
 --> src/main.rs:6:10
  |
6 | #[expect(missing_docs)]
  |          ^^^^^^^^^^^^
  |
  = 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.08s

Desired output

$ cargo check --all-targets
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s

Rationale and extra context

No response

Other cases

cargo clippy --all-targets has the same issue with clippy::enum_glob_use, however, there's no false positive on clippy::unreadable_literal.

Rust 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

Anything else?

Reported in rust-lang/rust-analyzer#17685.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsF-lint_reasons`#![feature(lint_reasons)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions