used_underscore_binding: do not lint on await desugaring

This commit is contained in:
Eduardo Broto
2020-04-27 00:12:51 +02:00
parent f2486b3d35
commit 3a96f548d1
3 changed files with 16 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ use rustc_hir::{
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::ty;
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::hygiene::DesugaringKind;
use rustc_span::source_map::{ExpnKind, Span};
use crate::consts::{constant, Constant};
@@ -399,8 +400,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
},
_ => {},
}
if in_attributes_expansion(expr) {
// Don't lint things expanded by #[derive(...)], etc
if in_attributes_expansion(expr) || expr.span.is_desugaring(DesugaringKind::Await) {
// Don't lint things expanded by #[derive(...)], etc or `await` desugaring
return;
}
let binding = match expr.kind {