From 98a49b594c0b6e01fd2c240d8f416862e4b6b3f2 Mon Sep 17 00:00:00 2001 From: Mikhail Babenko Date: Thu, 23 Jan 2020 18:20:50 +0300 Subject: [PATCH] disable let_underscore_must_use in external macros --- clippy_lints/src/let_underscore.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clippy_lints/src/let_underscore.rs b/clippy_lints/src/let_underscore.rs index 25828ffce532..c257b22df382 100644 --- a/clippy_lints/src/let_underscore.rs +++ b/clippy_lints/src/let_underscore.rs @@ -1,4 +1,5 @@ use if_chain::if_chain; +use rustc::lint::in_external_macro; use rustc_hir::*; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint_pass, declare_tool_lint}; @@ -33,6 +34,10 @@ declare_lint_pass!(LetUnderscore => [LET_UNDERSCORE_MUST_USE]); impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetUnderscore { fn check_stmt(&mut self, cx: &LateContext<'_, '_>, stmt: &Stmt<'_>) { + if in_external_macro(cx.tcx.sess, stmt.span) { + return; + } + if_chain! { if let StmtKind::Local(ref local) = stmt.kind; if let PatKind::Wild = local.pat.kind;