Skip to content

Commit 44f87e8

Browse files
committed
manual_range_patterns: Delay macro check.
1 parent 2309f8e commit 44f87e8

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

clippy_lints/src/manual_range_patterns.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,11 @@ impl Num {
7676

7777
impl LateLintPass<'_> for ManualRangePatterns {
7878
fn check_pat(&mut self, cx: &LateContext<'_>, pat: &'_ rustc_hir::Pat<'_>) {
79-
if in_external_macro(cx.sess(), pat.span) {
80-
return;
81-
}
82-
8379
// a pattern like 1 | 2 seems fine, lint if there are at least 3 alternatives
8480
// or at least one range
8581
if let PatKind::Or(pats) = pat.kind
8682
&& (pats.len() >= 3 || pats.iter().any(|p| matches!(p.kind, PatKind::Range(..))))
83+
&& !in_external_macro(cx.sess(), pat.span)
8784
{
8885
let mut min = Num::dummy(i128::MAX);
8986
let mut max = Num::dummy(i128::MIN);

0 commit comments

Comments
 (0)