aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2016-12-25 17:32:35 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2016-12-25 19:18:30 +0100
commit6264268c82d852ef86cb4308190dfb7f9468dcff (patch)
treefc8bae28755eae03bb89e4bb0b1bd40813f46d33
parenteaf69c29ec2c6952a925409e52529216315cf01e (diff)
downloadservo-6264268c82d852ef86cb4308190dfb7f9468dcff.tar.gz
servo-6264268c82d852ef86cb4308190dfb7f9468dcff.zip
style: Simplify initialization of thread_state.
-rw-r--r--components/style/thread_state.rs7
1 files 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