Stop calling deref() and deref_mut() explicitly.

This commit is contained in:
Ms2ger 2015-01-22 14:49:14 +01:00
parent ee4c56bd8b
commit 13c7cf928a
14 changed files with 56 additions and 57 deletions

View file

@ -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");