mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Stop calling deref() and deref_mut() explicitly.
This commit is contained in:
parent
ee4c56bd8b
commit
13c7cf928a
14 changed files with 56 additions and 57 deletions
|
@ -64,7 +64,7 @@ impl Scope {
|
|||
STATE_KEY.with(|ref r| {
|
||||
match &mut *r.borrow_mut() {
|
||||
&Some(ref mut state) => {
|
||||
let flow_trace = json::encode(&flow::base(state.flow_root.deref()));
|
||||
let flow_trace = json::encode(&flow::base(&*state.flow_root));
|
||||
let data = box ScopeData::new(name.clone(), flow_trace);
|
||||
state.scope_stack.push(data);
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ impl Drop for Scope {
|
|||
match &mut *r.borrow_mut() {
|
||||
&Some(ref mut state) => {
|
||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||
current_scope.post = json::encode(&flow::base(state.flow_root.deref()));
|
||||
current_scope.post = json::encode(&flow::base(&*state.flow_root));
|
||||
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||
previous_scope.children.push(current_scope);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ pub fn begin_trace(flow_root: FlowRef) {
|
|||
assert!(STATE_KEY.with(|ref r| r.borrow().is_none()));
|
||||
|
||||
STATE_KEY.with(|ref r| {
|
||||
let flow_trace = json::encode(&flow::base(flow_root.deref()));
|
||||
let flow_trace = json::encode(&flow::base(&*flow_root));
|
||||
let state = State {
|
||||
scope_stack: vec![box ScopeData::new("root".to_owned(), flow_trace)],
|
||||
flow_root: flow_root.clone(),
|
||||
|
@ -121,7 +121,7 @@ pub fn end_trace() {
|
|||
let mut task_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap());
|
||||
assert!(task_state.scope_stack.len() == 1);
|
||||
let mut root_scope = task_state.scope_stack.pop().unwrap();
|
||||
root_scope.post = json::encode(&flow::base(task_state.flow_root.deref()));
|
||||
root_scope.post = json::encode(&flow::base(&*task_state.flow_root));
|
||||
|
||||
let result = json::encode(&root_scope);
|
||||
let path = Path::new("layout_trace.json");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue