Files
rust/tests/ui/unnested_or_patterns2.fixed
T
Andrew V. Teylu f049a64100 Update Clippy test expectations for or-pattern parenthesization
The pretty printer now correctly parenthesizes or-patterns inside
`box` patterns, which changes the Clippy `unnested_or_patterns` lint
suggestion from `box box (0 | 2 | 4)` to `box (box (0 | 2 | 4))`.
The new output is more correct — the old suggestion was itself missing
parens and would have been parsed as `box (box 0) | 2 | 4`.

Signed-off-by: Andrew V. Teylu <andrew.teylu@vector.com>
2026-03-19 13:38:26 +00:00

29 lines
887 B
Rust

#![feature(box_patterns)]
#![warn(clippy::unnested_or_patterns)]
#![allow(
clippy::cognitive_complexity,
clippy::match_ref_pats,
clippy::needless_ifs,
clippy::manual_range_patterns
)]
#![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)]
fn main() {
if let Some(Some(0 | 1)) = None {}
//~^ unnested_or_patterns
if let Some(Some(0 | 1 | 2)) = None {}
//~^ unnested_or_patterns
if let Some(Some(0 | 1 | 2 | 3 | 4)) = None {}
//~^ unnested_or_patterns
if let Some(Some(0 | 1 | 2)) = None {}
//~^ unnested_or_patterns
if let ((0 | 1 | 2,),) = ((0,),) {}
//~^ unnested_or_patterns
if let 0 | 1 | 2 = 0 {}
//~^ unnested_or_patterns
if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
//~^ unnested_or_patterns
if let box (box (0 | 2 | 4)) = Box::new(Box::new(0)) {}
//~^ unnested_or_patterns
}