Skip to content

single_component_path_imports false positive for macros used in the same module #7923

@SabrinaJewson

Description

@SabrinaJewson

Lint name: single_component_path_imports

I tried this code:

m!();
macro_rules! m { () => {} }
use m;

I expected to see this happen: Clippy would not warn

Instead, this happened: Clippy showed this warning:

warning: this import is redundant
 --> src/lib.rs:3:1
  |
3 | use m;
  | ^^^^^^ 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

Meta

Rust version (rustc -Vv):

rustc 1.58.0-nightly (29b124802 2021-10-25)
binary: rustc
commit-hash: 29b1248025b19bd132c8047fc710ea9314b9b76b
commit-date: 2021-10-25
host: x86_64-unknown-linux-gnu
release: 1.58.0-nightly
LLVM version: 13.0.0

cc #7106

@rustbot label +I-suggestion-causes-error

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when applied

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions