Skip to content

Commit

Permalink
Auto merge of rust-lang#12400 - samueltardieu:issue-12395, r=Alexendoo
Browse files Browse the repository at this point in the history
[`let_underscore_untyped`]: fix false positive on async function

changelog: [`let_underscore_untyped`]: fix false positive on async function

Fix rust-lang#12395
  • Loading branch information
bors committed Mar 3, 2024
2 parents 5e0afee + 1df2854 commit 28e11b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clippy_lints/src/let_underscore.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::ty::{implements_trait, is_must_use_ty, match_type};
use clippy_utils::{is_from_proc_macro, is_must_use_func_call, paths};
use rustc_hir::{Local, PatKind};
use rustc_hir::{Local, LocalSource, PatKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty::{GenericArgKind, IsSuggestable};
Expand Down Expand Up @@ -139,7 +139,8 @@ const SYNC_GUARD_PATHS: [&[&str]; 3] = [

impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
fn check_local(&mut self, cx: &LateContext<'tcx>, local: &Local<'tcx>) {
if !in_external_macro(cx.tcx.sess, local.span)
if matches!(local.source, LocalSource::Normal)
&& !in_external_macro(cx.tcx.sess, local.span)
&& let PatKind::Wild = local.pat.kind
&& let Some(init) = local.init
{
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/let_underscore_untyped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ fn main() {
#[allow(clippy::let_underscore_untyped)]
let _ = a();
}

async fn dont_lint_async_prototype(_: u8) {}

0 comments on commit 28e11b3

Please sign in to comment.