diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2023-12-29 19:21:43 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-01-11 14:04:11 +0100 |
| commit | a24f4db41ba629a2477d6d332585faf5610c9210 (patch) | |
| tree | dd4854395d1b1c1f40b7a20214fedca0e7f697cf /compiler/rustc_pattern_analysis/src/lib.rs | |
| parent | 6f6ba2571d18d24dd041bc46e1ad57496714f117 (diff) | |
| download | rust-a24f4db41ba629a2477d6d332585faf5610c9210.tar.gz rust-a24f4db41ba629a2477d6d332585faf5610c9210.zip | |
Only lint ranges that really overlap
Diffstat (limited to 'compiler/rustc_pattern_analysis/src/lib.rs')
| -rw-r--r-- | compiler/rustc_pattern_analysis/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index 5d6a0f855f5..374914055d8 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -125,7 +125,9 @@ pub fn analyze_match<'p, 'tcx>( let pat_column = PatternColumn::new(arms); // Lint ranges that overlap on their endpoints, which is likely a mistake. - lint_overlapping_range_endpoints(cx, &pat_column)?; + 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. |
