1
Fork 0

ignore &x | &y in unnested_or_patterns

replacing it with `&(x | y)` is actually more characters
This commit is contained in:
Peter Jaszkowiak 2022-04-01 22:36:30 -06:00
parent 8ebe766695
commit c70f1e0f8f
4 changed files with 38 additions and 28 deletions

View file

@ -6,10 +6,13 @@
#![allow(unreachable_patterns, irrefutable_let_patterns, unused_variables)]
fn main() {
// Should be ignored by this lint, as nesting requires more characters.
if let &0 | &2 = &0 {}
if let box 0 | box 2 = Box::new(0) {}
if let box ((0 | 1)) | box (2 | 3) | box 4 = Box::new(0) {}
const C0: &u8 = &1;
if let &0 | C0 | &2 = &0 {}
const C0: Option<u8> = Some(1);
if let Some(1) | C0 | Some(2) = None {}
if let &mut 0 | &mut 2 = &mut 0 {}
if let x @ 0 | x @ 2 = 0 {}
if let (0, 1) | (0, 2) | (0, 3) = (0, 0) {}