From 6264268c82d852ef86cb4308190dfb7f9468dcff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sun, 25 Dec 2016 17:32:35 +0100 Subject: [PATCH] style: Simplify initialization of thread_state. --- components/style/thread_state.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/style/thread_state.rs b/components/style/thread_state.rs index b0fbd5f4294..9f6dc5df8e8 100644 --- a/components/style/thread_state.rs +++ b/components/style/thread_state.rs @@ -60,10 +60,9 @@ mod imp { pub fn initialize(x: ThreadState) { STATE.with(|ref k| { - match *k.borrow() { - Some(s) => panic!("Thread state already initialized as {:?}", s), - None => () - }; + if let Some(ref s) = *k.borrow() { + panic!("Thread state already initialized as {:?}", s); + } *k.borrow_mut() = Some(x); }); get(); // check the assertion below