diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-03-07 17:19:29 +0100 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2024-03-07 17:19:29 +0100 |
| commit | 7e83df40685907ea917813ec5b13fea360bdc070 (patch) | |
| tree | 477754a09b8ec72867209d71ac578b3a9071a413 /clippy_lints/src/let_underscore.rs | |
| parent | 0901b9fecf32c7dd84c83c454d30cbce11cbf2ea (diff) | |
Merge commit '93f0a9a91f58c9b2153868f458402155fb6265bb' into clippy-subtree-update
Diffstat (limited to 'clippy_lints/src/let_underscore.rs')
| -rw-r--r-- | clippy_lints/src/let_underscore.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/let_underscore.rs b/clippy_lints/src/let_underscore.rs index 606c2ed72be..0ea53c39280 100644 --- a/clippy_lints/src/let_underscore.rs +++ b/clippy_lints/src/let_underscore.rs @@ -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}; @@ -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 { |
