Skip to content

Commit

Permalink
Auto merge of #5082 - Areredify:issue-4980, r=flip1995
Browse files Browse the repository at this point in the history
disable let_underscore_must_use in external macros

changelog: disable let_underscore_must_use in external macros
Closes #4980
  • Loading branch information
bors committed Jan 23, 2020
2 parents eff3bc5 + 98a49b5 commit 951aed8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clippy_lints/src/let_underscore.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 951aed8

Please sign in to comment.