Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unused_qualifications warns about global paths #122374

Closed
rnbguy opened this issue Mar 12, 2024 · 0 comments · Fixed by #122435
Closed

unused_qualifications warns about global paths #122374

rnbguy opened this issue Mar 12, 2024 · 0 comments · Fixed by #122435
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@rnbguy
Copy link

rnbguy commented Mar 12, 2024

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
@rnbguy rnbguy added the C-bug Category: This is a bug. label Mar 12, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 12, 2024
@jieyouxu jieyouxu added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label Mar 12, 2024
@jieyouxu jieyouxu added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 13, 2024
@bors bors closed this as completed in 489c2e9 Mar 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 19, 2024
Rollup merge of rust-lang#122435 - jieyouxu:unused_qualifications_global_paths, r=petrochenkov

Don't trigger `unused_qualifications` on global paths

Fixes rust-lang#122374.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants