diff options
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index b52643adcc9..374914055d8 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -124,8 +124,10 @@ pub fn analyze_match<'p, 'tcx>( let pat_column = PatternColumn::new(arms); - // Lint on ranges that overlap on their endpoints, which is likely a mistake. - lint_overlapping_range_endpoints(cx, &pat_column)?; + // Lint ranges that overlap on their endpoints, which is likely a mistake. + if !report.overlapping_range_endpoints.is_empty() { + lint_overlapping_range_endpoints(cx, &report.overlapping_range_endpoints); + } // Run the non_exhaustive_omitted_patterns lint. Only run on refutable patterns to avoid hitting // `if let`s. Only run if the match is exhaustive otherwise the error is redundant. |
