diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-25 17:36:24 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-25 19:18:32 +0100 |
commit | cd00d65ffdf4430c07ad3a601a393afba6c2b3b9 (patch) | |
tree | 8e913be97850c66bc27b428d5f5eb4675b25936a | |
parent | 39e082af180f16d9dcbcc6ea48a5bcfc684f7742 (diff) | |
download | servo-cd00d65ffdf4430c07ad3a601a393afba6c2b3b9.tar.gz servo-cd00d65ffdf4430c07ad3a601a393afba6c2b3b9.zip |
layout: Simplify layout debugging scope.
-rw-r--r-- | components/layout/layout_debug.rs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index f98f253881f..3a8a1171287 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -65,13 +65,10 @@ struct State { impl Scope { pub fn new(name: String) -> Scope { STATE_KEY.with(|ref r| { - match *r.borrow_mut() { - Some(ref mut state) => { - let flow_trace = to_value(&flow::base(&*state.flow_root)); - let data = box ScopeData::new(name.clone(), flow_trace); - state.scope_stack.push(data); - } - None => {} + if let Some(ref mut state) = *r.borrow_mut() { + let flow_trace = to_value(&flow::base(&*state.flow_root)); + let data = box ScopeData::new(name.clone(), flow_trace); + state.scope_stack.push(data); } }); Scope @@ -82,14 +79,11 @@ impl Scope { impl Drop for Scope { fn drop(&mut self) { STATE_KEY.with(|ref r| { - match *r.borrow_mut() { - Some(ref mut state) => { - let mut current_scope = state.scope_stack.pop().unwrap(); - current_scope.post = to_value(&flow::base(&*state.flow_root)); - let previous_scope = state.scope_stack.last_mut().unwrap(); - previous_scope.children.push(current_scope); - } - None => {} + if let Some(ref mut state) = *r.borrow_mut() { + let mut current_scope = state.scope_stack.pop().unwrap(); + current_scope.post = to_value(&flow::base(&*state.flow_root)); + let previous_scope = state.scope_stack.last_mut().unwrap(); + previous_scope.children.push(current_scope); } }); } |