File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,10 @@ impl EarlyLintPass for ItemsAfterStatements {
58
58
if in_macro ( cx, it. span ) {
59
59
return ;
60
60
}
61
+ if let ItemKind :: MacroDef ( ..) = it. node {
62
+ // do not lint `macro_rules`, but continue processing further statements
63
+ continue ;
64
+ }
61
65
span_lint ( cx,
62
66
ITEMS_AFTER_STATEMENTS ,
63
67
it. span ,
Original file line number Diff line number Diff line change @@ -89,7 +89,6 @@ impl<'a> CompilerCalls<'a> for ClippyCompilerCalls {
89
89
lint_groups,
90
90
llvm_passes,
91
91
attributes,
92
- mir_passes,
93
92
.. } = registry;
94
93
let sess = & state. session ;
95
94
let mut ls = sess. lint_store . borrow_mut ( ) ;
@@ -105,7 +104,6 @@ impl<'a> CompilerCalls<'a> for ClippyCompilerCalls {
105
104
}
106
105
107
106
sess. plugin_llvm_passes . borrow_mut ( ) . extend ( llvm_passes) ;
108
- sess. mir_passes . borrow_mut ( ) . extend ( mir_passes) ;
109
107
sess. plugin_attributes . borrow_mut ( ) . extend ( attributes) ;
110
108
}
111
109
old ( state) ;
Original file line number Diff line number Diff line change @@ -17,3 +17,14 @@ fn main() {
17
17
fn foo ( ) { println ! ( "foo" ) ; }
18
18
foo ( ) ;
19
19
}
20
+
21
+ fn mac ( ) {
22
+ let mut a = 5 ;
23
+ println ! ( "{}" , a) ;
24
+ // do not lint this, because it needs to be after `a`
25
+ macro_rules! b {
26
+ ( ) => { { a = 6 } }
27
+ }
28
+ b ! ( ) ;
29
+ println ! ( "{}" , a) ;
30
+ }
You can’t perform that action at this time.
0 commit comments