diff options
| author | y21 <30553356+y21@users.noreply.github.com> | 2023-11-16 17:28:37 +0100 |
|---|---|---|
| committer | y21 <30553356+y21@users.noreply.github.com> | 2023-11-16 17:28:37 +0100 |
| commit | 1e0597cb68134ae221765deb3f3e9dd6d66f7dcc (patch) | |
| tree | 1afa123c32baa4e41265dcb2300105e3374a32eb | |
| parent | 23ee33255c1fe039ad81bb95682e3dfc15308502 (diff) | |
| download | rust-1e0597cb68134ae221765deb3f3e9dd6d66f7dcc.tar.gz rust-1e0597cb68134ae221765deb3f3e9dd6d66f7dcc.zip | |
[`match_same_arms`]: respect allow attrs on arms
| -rw-r--r-- | clippy_lints/src/matches/match_same_arms.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clippy_lints/src/matches/match_same_arms.rs b/clippy_lints/src/matches/match_same_arms.rs index 6fc79faddbe..ba9ca7c5a52 100644 --- a/clippy_lints/src/matches/match_same_arms.rs +++ b/clippy_lints/src/matches/match_same_arms.rs @@ -1,4 +1,4 @@ -use clippy_utils::diagnostics::span_lint_and_then; +use clippy_utils::diagnostics::span_lint_hir_and_then; use clippy_utils::source::snippet; use clippy_utils::{is_lint_allowed, path_to_local, search_same, SpanlessEq, SpanlessHash}; use core::cmp::Ordering; @@ -106,9 +106,10 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) { if !cx.tcx.features().non_exhaustive_omitted_patterns_lint || is_lint_allowed(cx, NON_EXHAUSTIVE_OMITTED_PATTERNS, arm2.hir_id) { - span_lint_and_then( + span_lint_hir_and_then( cx, MATCH_SAME_ARMS, + arm1.hir_id, arm1.span, "this match arm has an identical body to the `_` wildcard arm", |diag| { @@ -126,9 +127,10 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) { (arm2, arm1) }; - span_lint_and_then( + span_lint_hir_and_then( cx, MATCH_SAME_ARMS, + keep_arm.hir_id, keep_arm.span, "this match arm has an identical body to another arm", |diag| { |
