don't lint macro_rules! in items_after_statements
This commit is contained in:
parent
9aebb59a68
commit
2d145b2ef5
@ -58,6 +58,10 @@ impl EarlyLintPass for ItemsAfterStatements {
|
||||
if in_macro(cx, it.span) {
|
||||
return;
|
||||
}
|
||||
if let ItemKind::MacroDef(..) = it.node {
|
||||
// do not lint `macro_rules`, but continue processing further statements
|
||||
continue;
|
||||
}
|
||||
span_lint(cx,
|
||||
ITEMS_AFTER_STATEMENTS,
|
||||
it.span,
|
||||
|
@ -17,3 +17,14 @@ fn main() {
|
||||
fn foo() { println!("foo"); }
|
||||
foo();
|
||||
}
|
||||
|
||||
fn mac() {
|
||||
let mut a = 5;
|
||||
println!("{}", a);
|
||||
// do not lint this, because it needs to be after `a`
|
||||
macro_rules! b {
|
||||
() => {{ a = 6 }}
|
||||
}
|
||||
b!();
|
||||
println!("{}", a);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user