about summary refs log tree commit diff
path: root/tests/ui/unnested_or_patterns.fixed
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-08 00:37:56 +0000
committerbors <bors@rust-lang.org>2022-04-08 00:37:56 +0000
commita63308be0a66fe34aa1ccefef76fa6a0bc50d2a3 (patch)
tree66359167138505b8217830b22ffb05bfef103f11 /tests/ui/unnested_or_patterns.fixed
parent984330a6ee3c4d15626685d6dc8b7b759ff630bd (diff)
parentc70f1e0f8f3419f67dc31b5bbbc47db1e829128c (diff)
downloadrust-a63308be0a66fe34aa1ccefef76fa6a0bc50d2a3.tar.gz
rust-a63308be0a66fe34aa1ccefef76fa6a0bc50d2a3.zip
Auto merge of #8619 - pitaj:fix-6973, r=giraffate
ignore `&x | &y` in unnested_or_patterns

replacing it with `&(x | y)` is actually more characters

Fixes #6973

changelog: [`unnested_or_patterns`] ignore `&x | &y`, nesting would result in more characters
Diffstat (limited to 'tests/ui/unnested_or_patterns.fixed')
-rw-r--r--tests/ui/unnested_or_patterns.fixed7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/ui/unnested_or_patterns.fixed b/tests/ui/unnested_or_patterns.fixed
index 46463a29e9b..c223b5bc711 100644
--- a/tests/ui/unnested_or_patterns.fixed
+++ b/tests/ui/unnested_or_patterns.fixed
@@ -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 | 2) = Box::new(0) {}
     if let box (0 | 1 | 2 | 3 | 4) = Box::new(0) {}
-    const C0: &u8 = &1;
-    if let &(0 | 2) | C0 = &0 {}
+    const C0: Option<u8> = Some(1);
+    if let Some(1 | 2) | C0 = None {}
     if let &mut (0 | 2) = &mut 0 {}
     if let x @ (0 | 2) = 0 {}
     if let (0, 1 | 2 | 3) = (0, 0) {}