rust-clippy
rust-clippy copied to clipboard
single_component_path_imports should respect #[allow(unused_imports)]
Summary
To achieve dynamic linking, I use this:
#[cfg(feature = "dynamic")]
#[allow(unused_imports)]
use kas_dylib;
Without this import, built executables do not dynamically link this library. Bevy does the same.
Clippy complains:
warning: this import is redundant
--> src/lib.rs:59:1
|
59 | use kas_dylib;
| ^^^^^^^^^^^^^^ help: remove it entirely
|
= note: `#[warn(clippy::single_component_path_imports)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
Since this import already has #[allow(unused_imports)] I would expect Clippy to ignore it.
Lint Name
single_component_path_imports
Reproducer
No response
Version
rustc 1.64.0-nightly (2f3ddd9f5 2022-06-27)
Additional Labels
No response
@dhardy Is it still issue? Can't reproduce it playground
Yes. On kas master:
❯ rustc +nightly -V
rustc 1.64.0-nightly (f6f9d5e73 2022-08-04)
❯ cargo +nightly clippy --all-features
[...]
Checking kas v0.11.0 (/home/dhardy/projects/kas/kas)
warning: this import is redundant
--> src/lib.rs:112:1
|
112 | use kas_dylib;
| ^^^^^^^^^^^^^^ help: remove it entirely
|
= note: `#[warn(clippy::single_component_path_imports)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
Clippy now respects #[allow(unused_imports)], this issue can now be closed.