Skip to content

Commit a603635

Browse files
committed
rustc_arena: remove a couple of ref patterns
1 parent 616df0f commit a603635

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

compiler/rustc_arena/src/tests.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,15 @@ fn test_arena_alloc_nested() {
5252

5353
impl<'a> Wrap<'a> {
5454
fn alloc_inner<F: Fn() -> Inner>(&self, f: F) -> &Inner {
55-
let r: &EI<'_> = self.0.alloc(EI::I(f()));
56-
if let &EI::I(ref i) = r {
57-
i
58-
} else {
59-
panic!("mismatch");
55+
match self.0.alloc(EI::I(f())) {
56+
EI::I(i) => i,
57+
_ => panic!("mismatch"),
6058
}
6159
}
6260
fn alloc_outer<F: Fn() -> Outer<'a>>(&self, f: F) -> &Outer<'_> {
63-
let r: &EI<'_> = self.0.alloc(EI::O(f()));
64-
if let &EI::O(ref o) = r {
65-
o
66-
} else {
67-
panic!("mismatch");
61+
match self.0.alloc(EI::O(f())) {
62+
EI::O(o) => o,
63+
_ => panic!("mismatch"),
6864
}
6965
}
7066
}

0 commit comments

Comments
 (0)