-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP auto-applicable suggestion macro-use-imports
- Loading branch information
Showing
4 changed files
with
159 additions
and
87 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
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,32 @@ | ||
// pub use macro_rules::foofoo; | ||
// pub use crate::extern_exports::*; | ||
|
||
#[macro_export] | ||
macro_rules! pub_macro { | ||
() => { | ||
let _ = "hello Mr. Vonnegut"; | ||
}; | ||
} | ||
|
||
|
||
pub mod inner { | ||
#[macro_export] | ||
macro_rules! inner_mod { | ||
() => { | ||
#[allow(dead_code)] | ||
pub struct Tardis; | ||
}; | ||
} | ||
} | ||
|
||
mod extern_exports { | ||
|
||
pub(super) mod private_inner { | ||
#[macro_export] | ||
macro_rules! pub_in_private { | ||
($name:ident) => { | ||
let $name = String::from("secrets and lies"); | ||
}; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,21 +1,30 @@ | ||
// compile-flags: --edition 2018 | ||
// aux-build:macro_use_helper.rs | ||
|
||
// aux-build:macro_rules.rs | ||
#![allow(clippy::single_component_path_imports)] | ||
#![warn(clippy::macro_use_imports)] | ||
#![feature(rustc_private)] | ||
|
||
use std::collections::HashMap; | ||
#[macro_use] | ||
use std::{prelude, sync::Mutex}; | ||
extern crate macro_use_helper as mac; | ||
#[macro_use] | ||
extern crate rustc_session; | ||
use std::prelude; | ||
|
||
mod a { | ||
use std::collections::HashMap; | ||
#[macro_use] | ||
use mac; | ||
|
||
fn main() { | ||
let _ = HashMap::<u8, u8>::new(); | ||
println!(); | ||
pub_macro!(); | ||
inner_mod!(); | ||
pub_in_private!(_var); | ||
} | ||
} | ||
|
||
fn main() { | ||
let _ = Mutex::new(8_u8); | ||
let _ = HashMap::<u8, u8>::new(); | ||
println!(); | ||
declare_tool_lint! { | ||
pub clippy::TEST_LINT, | ||
Warn, | ||
"", | ||
report_in_external_macro: true | ||
} | ||
} |