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 85f7bbb637c..8c895915921 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -99,6 +99,10 @@ fn check_fn( 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 @@ fn check_fn( }; if_chain! { - if !in_macro(span); if let Some(snip) = snippet_opt(cx, span); if let Some(dot) = snip.rfind('.'); then {