Merge pull request #3330 from shssoichiro/3309-goblin-ice
Resolve ICE in needless range loop lint
This commit is contained in:
commit
adbaa85ee9
2 changed files with 10 additions and 1 deletions
|
@ -31,7 +31,7 @@ use std::mem;
|
|||
use crate::syntax::ast;
|
||||
use crate::syntax::source_map::Span;
|
||||
use crate::syntax_pos::BytePos;
|
||||
use crate::utils::{sugg, sext};
|
||||
use crate::utils::{in_macro, sugg, sext};
|
||||
use crate::utils::usage::mutated_variables;
|
||||
use crate::consts::{constant, Constant};
|
||||
|
||||
|
@ -1030,6 +1030,10 @@ fn check_for_loop_range<'a, 'tcx>(
|
|||
body: &'tcx Expr,
|
||||
expr: &'tcx Expr,
|
||||
) {
|
||||
if in_macro(expr.span) {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(higher::Range {
|
||||
start: Some(start),
|
||||
ref end,
|
||||
|
|
|
@ -17,5 +17,10 @@ use proc_macro::{TokenStream, quote};
|
|||
pub fn mini_macro(_: TokenStream) -> TokenStream {
|
||||
quote!(
|
||||
#[allow(unused)] fn needless_take_by_value(s: String) { println!("{}", s.len()); }
|
||||
#[allow(unused)] fn needless_loop(items: &[u8]) {
|
||||
for i in 0..items.len() {
|
||||
println!("{}", items[i]);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue