Refactor to remove unnecessary unwrap.
This commit is contained in:
parent
23c0b3c547
commit
d582b0fec9
1 changed files with 3 additions and 4 deletions
|
@ -144,10 +144,7 @@ where
|
||||||
if node.1 > 0 {
|
if node.1 > 0 {
|
||||||
self.anchor_map.insert(node.1, node.0.clone());
|
self.anchor_map.insert(node.1, node.0.clone());
|
||||||
}
|
}
|
||||||
if self.doc_stack.is_empty() {
|
if let Some(parent) = self.doc_stack.last_mut() {
|
||||||
self.doc_stack.push(node);
|
|
||||||
} else {
|
|
||||||
let parent = self.doc_stack.last_mut().unwrap();
|
|
||||||
let parent_node = &mut parent.0;
|
let parent_node = &mut parent.0;
|
||||||
if parent_node.is_array() {
|
if parent_node.is_array() {
|
||||||
parent_node.array_mut().push(node.0);
|
parent_node.array_mut().push(node.0);
|
||||||
|
@ -162,6 +159,8 @@ where
|
||||||
hash.insert(cur_key.take(), node.0);
|
hash.insert(cur_key.take(), node.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self.doc_stack.push(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue