From 2a01cec52179dc7b47ed970b4dab566b0f07dc3a Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 4 Apr 2015 14:21:42 -0700 Subject: [PATCH] Utilize Option::expect --- components/script/dom/bindings/cell.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index f2a1504f8b9..b64d80cefc3 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -125,10 +125,7 @@ impl DOMRefCell { /// /// Panics if the value is currently mutably borrowed. pub fn borrow<'a>(&'a self) -> Ref<'a, T> { - match self.try_borrow() { - Some(ptr) => ptr, - None => panic!("DOMRefCell already mutably borrowed") - } + self.try_borrow().expect("DOMRefCell already mutably borrowed") } /// Mutably borrows the wrapped value. @@ -142,9 +139,6 @@ impl DOMRefCell { /// /// Panics if the value is currently borrowed. pub fn borrow_mut<'a>(&'a self) -> RefMut<'a, T> { - match self.try_borrow_mut() { - Some(ptr) => ptr, - None => panic!("DOMRefCell already borrowed") - } + self.try_borrow_mut().expect("DOMRefCell already borrowed") } }