about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Krones <hello@philkrones.com>2023-08-11 10:51:18 +0200
committerPhilipp Krones <hello@philkrones.com>2023-08-11 10:51:18 +0200
commit0fc051ddbaaa4daf567c46240c6effabcde176f5 (patch)
treef0336c466d0bb6d31af583288142bf91399405d6
parent61e9b157e2f81962f17de4274eb44cb0dc25983f (diff)
downloadrust-0fc051ddbaaa4daf567c46240c6effabcde176f5.tar.gz
rust-0fc051ddbaaa4daf567c46240c6effabcde176f5.zip
Fix redundant_locals for Async desugaring
-rw-r--r--clippy_lints/src/redundant_locals.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_lints/src/redundant_locals.rs b/clippy_lints/src/redundant_locals.rs
index 140ae837a17..1271cf38538 100644
--- a/clippy_lints/src/redundant_locals.rs
+++ b/clippy_lints/src/redundant_locals.rs
@@ -7,6 +7,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext};
 use rustc_middle::lint::in_external_macro;
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::symbol::Ident;
+use rustc_span::DesugaringKind;
 
 declare_clippy_lint! {
     /// ### What it does
@@ -45,6 +46,7 @@ declare_lint_pass!(RedundantLocals => [REDUNDANT_LOCALS]);
 impl<'tcx> LateLintPass<'tcx> for RedundantLocals {
     fn check_local(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
         if_chain! {
+            if !local.span.is_desugaring(DesugaringKind::Async);
             // the pattern is a single by-value binding
             if let PatKind::Binding(BindingAnnotation(ByRef::No, mutability), _, ident, None) = local.pat.kind;
             // the binding is not type-ascribed