Skip to content

Commit 28e11b3

Browse files
committed
Auto merge of #12400 - samueltardieu:issue-12395, r=Alexendoo
[`let_underscore_untyped`]: fix false positive on async function changelog: [`let_underscore_untyped`]: fix false positive on async function Fix #12395
2 parents 5e0afee + 1df2854 commit 28e11b3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

clippy_lints/src/let_underscore.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use clippy_utils::ty::{implements_trait, is_must_use_ty, match_type};
33
use clippy_utils::{is_from_proc_macro, is_must_use_func_call, paths};
4-
use rustc_hir::{Local, PatKind};
4+
use rustc_hir::{Local, LocalSource, PatKind};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::lint::in_external_macro;
77
use rustc_middle::ty::{GenericArgKind, IsSuggestable};
@@ -139,7 +139,8 @@ const SYNC_GUARD_PATHS: [&[&str]; 3] = [
139139

140140
impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
141141
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &Local<'tcx>) {
142-
if !in_external_macro(cx.tcx.sess, local.span)
142+
if matches!(local.source, LocalSource::Normal)
143+
&& !in_external_macro(cx.tcx.sess, local.span)
143144
&& let PatKind::Wild = local.pat.kind
144145
&& let Some(init) = local.init
145146
{

tests/ui/let_underscore_untyped.rs

+2
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ fn main() {
7373
#[allow(clippy::let_underscore_untyped)]
7474
let _ = a();
7575
}
76+
77+
async fn dont_lint_async_prototype(_: u8) {}

0 commit comments

Comments
 (0)