Skip to content

unused_qualifications warns about global paths #122374

Closed
@rnbguy

Description

@rnbguy

I tried this code:

pub fn bar() -> u64 {
    ::core::default::Default::default()
}

fn main() {}

I expected to see it pass with unused_qualifications lints. As it does on stable.

$ cargo clippy -- -W unused_qualifications
    Checking foo v0.1.0 (/home/user/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 0.06s

Instead, nightly suggests to replace the global path.

$ cargo +nightly clippy -- -W unused_qualifications
    Checking foo v0.1.0 (/home/user/foo)
warning: unnecessary qualification
 --> src/main.rs:2:5
  |
2 |     ::core::default::Default::default()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: requested on the command line with `-W unused-qualifications`
help: remove the unnecessary path segments
  |
2 -     ::core::default::Default::default()
2 +     Default::default()
  |

Meta

$ rustc +nightly --version --verbose
rustc 1.78.0-nightly (4a0cc881d 2024-03-11)
binary: rustc
commit-hash: 4a0cc881dcc4d800f10672747f61a94377ff6662
commit-date: 2024-03-11
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.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