diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_prof/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_prof/src/lib.rs b/crates/ra_prof/src/lib.rs index d95e7eb1b..e2c32c130 100644 --- a/crates/ra_prof/src/lib.rs +++ b/crates/ra_prof/src/lib.rs | |||
@@ -271,10 +271,10 @@ fn print_for_idx( | |||
271 | /// In other words, a postorder of the call graph. In particular, the root is the last element of | 271 | /// In other words, a postorder of the call graph. In particular, the root is the last element of |
272 | /// `msgs`. | 272 | /// `msgs`. |
273 | fn idx_to_children(msgs: &[Message]) -> Vec<Vec<usize>> { | 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 | let mut ancestors = vec![msgs.len() - 1]; | 276 | let mut ancestors = vec![msgs.len() - 1]; |
276 | let mut result: Vec<Vec<usize>> = vec![]; | 277 | let mut result: Vec<Vec<usize>> = vec![vec![]; msgs.len()]; |
277 | result.resize_with(msgs.len(), Default::default); | ||
278 | for (idx, msg) in msgs[..msgs.len() - 1].iter().enumerate().rev() { | 278 | for (idx, msg) in msgs[..msgs.len() - 1].iter().enumerate().rev() { |
279 | // We need to find the parent of the current message, i.e., the last ancestor that has a | 279 | // We need to find the parent of the current message, i.e., the last ancestor that has a |
280 | // level lower than the current message. | 280 | // level lower than the current message. |