Skip to content

Commit 1e0597c

Browse files
committed
[match_same_arms]: respect allow attrs on arms
1 parent 23ee332 commit 1e0597c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clippy_lints/src/matches/match_same_arms.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::diagnostics::span_lint_and_then;
1+
use clippy_utils::diagnostics::span_lint_hir_and_then;
22
use clippy_utils::source::snippet;
33
use clippy_utils::{is_lint_allowed, path_to_local, search_same, SpanlessEq, SpanlessHash};
44
use core::cmp::Ordering;
@@ -106,9 +106,10 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
106106
if !cx.tcx.features().non_exhaustive_omitted_patterns_lint
107107
|| is_lint_allowed(cx, NON_EXHAUSTIVE_OMITTED_PATTERNS, arm2.hir_id)
108108
{
109-
span_lint_and_then(
109+
span_lint_hir_and_then(
110110
cx,
111111
MATCH_SAME_ARMS,
112+
arm1.hir_id,
112113
arm1.span,
113114
"this match arm has an identical body to the `_` wildcard arm",
114115
|diag| {
@@ -126,9 +127,10 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'_>]) {
126127
(arm2, arm1)
127128
};
128129

129-
span_lint_and_then(
130+
span_lint_hir_and_then(
130131
cx,
131132
MATCH_SAME_ARMS,
133+
keep_arm.hir_id,
132134
keep_arm.span,
133135
"this match arm has an identical body to another arm",
134136
|diag| {

0 commit comments

Comments
 (0)