Skip to content

Commit

Permalink
Refactor to remove unnecessary unwrap.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethiraric committed Jul 2, 2024
1 parent 23c0b3c commit d582b0f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions saphyr/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@ where
if node.1 > 0 {
self.anchor_map.insert(node.1, node.0.clone());
}
if self.doc_stack.is_empty() {
self.doc_stack.push(node);
} else {
let parent = self.doc_stack.last_mut().unwrap();
if let Some(parent) = self.doc_stack.last_mut() {
let parent_node = &mut parent.0;
if parent_node.is_array() {
parent_node.array_mut().push(node.0);
Expand All @@ -162,6 +159,8 @@ where
hash.insert(cur_key.take(), node.0);
}
}
} else {
self.doc_stack.push(node);
}
}

Expand Down

0 comments on commit d582b0f

Please sign in to comment.