From 9034b87a539904c96c01ece3c43878ce25887214 Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Fri, 26 Oct 2018 03:07:29 +0900 Subject: [PATCH] Move in_macro check --- clippy_lints/src/redundant_clone.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 85f7bbb63..8c8959159 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -99,6 +99,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { for (bb, bbdata) in mir.basic_blocks().iter_enumerated() { let terminator = bbdata.terminator(); + if in_macro(terminator.source_info.span) { + continue; + } + // Give up on loops if terminator.successors().any(|s| *s == bb) { continue; @@ -174,7 +178,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { }; if_chain! { - if !in_macro(span); if let Some(snip) = snippet_opt(cx, span); if let Some(dot) = snip.rfind('.'); then {