File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ use std::mem;
31
31
use crate :: syntax:: ast;
32
32
use crate :: syntax:: source_map:: Span ;
33
33
use crate :: syntax_pos:: BytePos ;
34
- use crate :: utils:: { sugg, sext} ;
34
+ use crate :: utils:: { in_macro , sugg, sext} ;
35
35
use crate :: utils:: usage:: mutated_variables;
36
36
use crate :: consts:: { constant, Constant } ;
37
37
@@ -1030,6 +1030,10 @@ fn check_for_loop_range<'a, 'tcx>(
1030
1030
body : & ' tcx Expr ,
1031
1031
expr : & ' tcx Expr ,
1032
1032
) {
1033
+ if in_macro ( expr. span ) {
1034
+ return ;
1035
+ }
1036
+
1033
1037
if let Some ( higher:: Range {
1034
1038
start : Some ( start) ,
1035
1039
ref end,
Original file line number Diff line number Diff line change @@ -17,5 +17,10 @@ use proc_macro::{TokenStream, quote};
17
17
pub fn mini_macro ( _: TokenStream ) -> TokenStream {
18
18
quote ! (
19
19
#[ allow( unused) ] fn needless_take_by_value( s: String ) { println!( "{}" , s. len( ) ) ; }
20
+ #[ allow( unused) ] fn needless_loop( items: & [ u8 ] ) {
21
+ for i in 0 ..items. len( ) {
22
+ println!( "{}" , items[ i] ) ;
23
+ }
24
+ }
20
25
)
21
26
}
You can’t perform that action at this time.
0 commit comments