Skip to content

Commit c81888e

Browse files
committed
fix FP of let_unit_value on async fn args
1 parent 0273ed3 commit c81888e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/unit_types/let_unit_value.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_errors::Applicability;
77
use rustc_hir::def::{DefKind, Res};
88
use rustc_hir::{Expr, ExprKind, HirId, HirIdSet, Local, MatchSource, Node, PatKind, QPath, TyKind};
99
use rustc_lint::{LateContext, LintContext};
10-
use rustc_middle::lint::in_external_macro;
10+
use rustc_middle::lint::{in_external_macro, is_from_async_await};
1111
use rustc_middle::ty;
1212

1313
use super::LET_UNIT_VALUE;
@@ -16,6 +16,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, local: &'tcx Local<'_>) {
1616
if let Some(init) = local.init
1717
&& !local.pat.span.from_expansion()
1818
&& !in_external_macro(cx.sess(), local.span)
19+
&& !is_from_async_await(local.span)
1920
&& cx.typeck_results().pat_ty(local.pat).is_unit()
2021
{
2122
if (local.ty.map_or(false, |ty| !matches!(ty.kind, TyKind::Infer))

0 commit comments

Comments
 (0)