Skip to content

Commit a59043c

Browse files
committed
test(deep_causality_ast): refactored depth calculation.
Signed-off-by: Marvin Hansen <[email protected]>
1 parent 4488331 commit a59043c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

deep_causality_ast/src/const_tree/accessors.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@ impl<T> ConstTree<T> {
7878
let mut max_depth = 0;
7979
let mut queue = VecDeque::new();
8080

81-
if !self.is_leaf() {
82-
// Push the root node with depth 1 to start.
83-
queue.push_back((self, 1));
84-
} else {
85-
return 1;
86-
}
81+
// Always start with the root node at depth 1.
82+
queue.push_back((self, 1));
8783

8884
while let Some((current_node, current_depth)) = queue.pop_front() {
8985
max_depth = max_depth.max(current_depth);

0 commit comments

Comments
 (0)