Skip to content

False positive warning on if keyword for unused_qualifications #149873

@djc

Description

@djc

Code

See here:

https://github.com/hickory-dns/hickory-dns/blob/ac67742d64717cf61299871554590beb7c0c296c/crates/proto/src/multicast/mdns_stream.rs#L456

(After enabling unused_qualifications = "warn" via Cargo.toml.)

Current output

warning: unnecessary qualification
   --> crates/proto/src/multicast/mdns_stream.rs:456:9
    |
456 |         if let Err(error) = result {
    |         ^^
    |
    = note: requested on the command line with `-W unused-qualifications`

warning: `hickory-proto` (lib test) generated 1 warning (run `cargo fix --lib -p hickory-proto --tests` to apply 1 suggestion)

Desired output

No warning.

Rationale and extra context

Image

Clearly the lint should not fire on language keywords.

Other cases

Rust Version

rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: aarch64-apple-darwin
release: 1.92.0
LLVM version: 21.1.3

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleL-unused_qualificationsLint: unused_qualificationsT-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