forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
single_component_path_imports
: ignore pub(crate) use some_macro;
(f…
…ixes rust-lang#7106)
- Loading branch information
1 parent
ec38ea1
commit b48699e
Showing
4 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// run-rustfix | ||
// edition:2018 | ||
#![warn(clippy::single_component_path_imports)] | ||
#![allow(unused_imports)] | ||
|
||
// #7106: use statements exporting a macro within a crate should not trigger lint | ||
|
||
macro_rules! m1 { | ||
() => {}; | ||
} | ||
pub(crate) use m1; // ok | ||
|
||
macro_rules! m2 { | ||
() => {}; | ||
} | ||
// fail | ||
|
||
fn main() { | ||
m1!(); | ||
m2!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// run-rustfix | ||
// edition:2018 | ||
#![warn(clippy::single_component_path_imports)] | ||
#![allow(unused_imports)] | ||
|
||
// #7106: use statements exporting a macro within a crate should not trigger lint | ||
|
||
macro_rules! m1 { | ||
() => {}; | ||
} | ||
pub(crate) use m1; // ok | ||
|
||
macro_rules! m2 { | ||
() => {}; | ||
} | ||
use m2; // fail | ||
|
||
fn main() { | ||
m1!(); | ||
m2!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
error: this import is redundant | ||
--> $DIR/single_component_path_imports_macro.rs:16:1 | ||
| | ||
LL | use m2; // fail | ||
| ^^^^^^^ help: remove it entirely | ||
| | ||
= note: `-D clippy::single-component-path-imports` implied by `-D warnings` | ||
|
||
error: aborting due to previous error | ||
|