From bd25230882c31e34a233431034b0ad7e5b3f81c2 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Fri, 4 Nov 2016 09:15:31 +0100 Subject: [PATCH] nit: move if let into match --- src/interpreter/terminator/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/interpreter/terminator/mod.rs b/src/interpreter/terminator/mod.rs index c94ea97b056..fdd703e940b 100644 --- a/src/interpreter/terminator/mod.rs +++ b/src/interpreter/terminator/mod.rs @@ -521,16 +521,16 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { } trace!("-need to drop {:?} at {:?}", ty, lval); - // special case `Box` to deallocate the inner allocation - if let ty::TyBox(contents_ty) = ty.sty { - let val = self.read_lvalue(lval)?; - let contents_ptr = val.read_ptr(&self.memory)?; - self.drop(Lvalue::from_ptr(contents_ptr), contents_ty, drop)?; - trace!("-deallocating box"); - return self.memory.deallocate(contents_ptr); - } - match ty.sty { + // special case `Box` to deallocate the inner allocation + ty::TyBox(contents_ty) => { + let val = self.read_lvalue(lval)?; + let contents_ptr = val.read_ptr(&self.memory)?; + self.drop(Lvalue::from_ptr(contents_ptr), contents_ty, drop)?; + trace!("-deallocating box"); + self.memory.deallocate(contents_ptr)?; + }, + ty::TyAdt(adt_def, substs) => { // FIXME: some structs are represented as ByValPair let adt_ptr = self.force_allocation(lval)?.to_ptr();