about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-11-22 09:49:31 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-11-22 18:49:29 +0000
commita60363567015323a85b9ee890fd1076573e7d2b8 (patch)
tree99229dc6f63e08da7b7d285263fcf3b4cfddfbe7
parent616df0f03ba343588ccc7894758f89825012d711 (diff)
downloadrust-a60363567015323a85b9ee890fd1076573e7d2b8.tar.gz
rust-a60363567015323a85b9ee890fd1076573e7d2b8.zip
`rustc_arena`: remove a couple of `ref` patterns
-rw-r--r--compiler/rustc_arena/src/tests.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/compiler/rustc_arena/src/tests.rs b/compiler/rustc_arena/src/tests.rs
index ad61464343a..49a070badc6 100644
--- a/compiler/rustc_arena/src/tests.rs
+++ b/compiler/rustc_arena/src/tests.rs
@@ -52,19 +52,15 @@ fn test_arena_alloc_nested() {
 
     impl<'a> Wrap<'a> {
         fn alloc_inner<F: Fn() -> Inner>(&self, f: F) -> &Inner {
-            let r: &EI<'_> = self.0.alloc(EI::I(f()));
-            if let &EI::I(ref i) = r {
-                i
-            } else {
-                panic!("mismatch");
+            match self.0.alloc(EI::I(f())) {
+                EI::I(i) => i,
+                _ => panic!("mismatch"),
             }
         }
         fn alloc_outer<F: Fn() -> Outer<'a>>(&self, f: F) -> &Outer<'_> {
-            let r: &EI<'_> = self.0.alloc(EI::O(f()));
-            if let &EI::O(ref o) = r {
-                o
-            } else {
-                panic!("mismatch");
+            match self.0.alloc(EI::O(f())) {
+                EI::O(o) => o,
+                _ => panic!("mismatch"),
             }
         }
     }