diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 412571ceb..6fbe47c9e 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { cond=snippet(cx, cond.span, "_"), then=if then.stmts.len() > 1 { " ..;" } else { "" }, else=if default_multi_stmts { " ..;" } else { "" }, - value=snippet(cx, then.span, ""), + value=snippet(cx, value.span, ""), default=snippet(cx, default.span, ""), ); span_lint_and_then(cx, diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 47784113d..ce5065a91 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -357,6 +357,9 @@ pub fn method_chain_args<'a>(expr: &'a Expr, methods: &[&str]) -> Option first if let ExprMethodCall(ref name, _, ref args) = current.node { if name.node == *method_name { + if args.iter().any(|e| in_macro(e.span)) { + return None; + } matched.push(&**args); // build up `matched` backwards current = &args[0] // go to parent expression } else { diff --git a/tests/run-pass/mut_mut_macro.rs b/tests/run-pass/mut_mut_macro.rs index 9f63a6b2d..a6473b0f9 100644 --- a/tests/run-pass/mut_mut_macro.rs +++ b/tests/run-pass/mut_mut_macro.rs @@ -20,13 +20,12 @@ fn main() { lazy_static! { static ref MUT_MAP : HashMap = { let mut m = HashMap::new(); - let mut zero = &mut &mut "zero"; m.insert(0, "zero"); m }; static ref MUT_COUNT : usize = MUT_MAP.len(); } - assert!(*MUT_COUNT == 1); + assert_eq!(*MUT_COUNT, 1); // FIXME: don't lint in array length, requires `check_body` //let _ = [""; (42.0 < std::f32::NAN) as usize]; }