Skip to content

Commit 0fc051d

Browse files
committed
Fix redundant_locals for Async desugaring
1 parent 61e9b15 commit 0fc051d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clippy_lints/src/redundant_locals.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext};
77
use rustc_middle::lint::in_external_macro;
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::symbol::Ident;
10+
use rustc_span::DesugaringKind;
1011

1112
declare_clippy_lint! {
1213
/// ### What it does
@@ -45,6 +46,7 @@ declare_lint_pass!(RedundantLocals => [REDUNDANT_LOCALS]);
4546
impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
4647
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
4748
if_chain! {
49+
if !local.span.is_desugaring(DesugaringKind::Async);
4850
// the pattern is a single by-value binding
4951
if let PatKind::Binding(BindingAnnotation(ByRef::No, mutability), _, ident, None) = local.pat.kind;
5052
// the binding is not type-ascribed

0 commit comments

Comments
 (0)