aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_prof/src
diff options
context:
space:
mode:
authorMichal Terepeta <[email protected]>2020-01-29 19:55:35 +0000
committerMichal Terepeta <[email protected]>2020-01-29 19:55:35 +0000
commit644c383f65324b5fe1ada42680923c2529accb26 (patch)
tree9cd60268cc0b03db87c955043c805307d126ee50 /crates/ra_prof/src
parent39cbb6b620244fcf921f45669ed40cc6ebdf6520 (diff)
A couple of small improvements to ra_prof printing
Based on suggestions from @matklad. Signed-off-by: Michal Terepeta <[email protected]>
Diffstat (limited to 'crates/ra_prof/src')
-rw-r--r--crates/ra_prof/src/lib.rs6
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`.
273fn idx_to_children(msgs: &[Message]) -> Vec<Vec<usize>> { 273fn 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.