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

FP single-component-path-imports : self::<import>::... #10549

Closed
matthiaskrgr opened this issue Mar 25, 2023 · 0 comments · Fixed by #10566
Closed

FP single-component-path-imports : self::<import>::... #10549

matthiaskrgr opened this issue Mar 25, 2023 · 0 comments · Fixed by #10566
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@matthiaskrgr
Copy link
Member

Summary

.

Lint Name

single_component_path_imports

Reproducer

I tried this code:

use std;

fn main() {
    let _ = self::std::io::stdout();
}

I saw this happen:

warning: this import is redundant
 --> src/main.rs:1:1
  |
1 | use std;
  | ^^^^^^^^ help: remove it entirely
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
  = note: `#[warn(clippy::single_component_path_imports)]` on by default

Applying the suggestion breaks the build:

The following errors were reported:
error[E0433]: failed to resolve: could not find `std` in the crate root
 --> src/main.rs:8:19
  |
8 |     let _ = self::std::io::stdout();
  |                   ^^^ could not find `std` in the crate root

error: aborting due to previous error

For more information about this error, try `rustc --explain E0433`.
Original diagnostics will follow.

Version

rustc 1.70.0-nightly (8be3c2bda 2023-03-24)
binary: rustc
commit-hash: 8be3c2bda6b683f87b24714ba595e8b04faef54c
commit-date: 2023-03-24
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Additional Labels

No response

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied I-false-positive Issue: The lint was triggered on code it shouldn't have labels Mar 25, 2023
@bors bors closed this as completed in 9408d01 Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant