File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -271,10 +271,10 @@ fn print_for_idx(
271
271
/// In other words, a postorder of the call graph. In particular, the root is the last element of
272
272
/// `msgs`.
273
273
fn idx_to_children ( msgs : & [ Message ] ) -> Vec < Vec < usize > > {
274
- // Initialize with the index of the root; `ancestors` should be never empty.
274
+ // Initialize with the index of the root; `msgs` and `ancestors` should be never empty.
275
+ assert ! ( !msgs. is_empty( ) ) ;
275
276
let mut ancestors = vec ! [ msgs. len( ) - 1 ] ;
276
- let mut result: Vec < Vec < usize > > = vec ! [ ] ;
277
- result. resize_with ( msgs. len ( ) , Default :: default) ;
277
+ let mut result: Vec < Vec < usize > > = vec ! [ vec![ ] ; msgs. len( ) ] ;
278
278
for ( idx, msg) in msgs[ ..msgs. len ( ) - 1 ] . iter ( ) . enumerate ( ) . rev ( ) {
279
279
// We need to find the parent of the current message, i.e., the last ancestor that has a
280
280
// level lower than the current message.
You can’t perform that action at this time.
0 commit comments