diff options
Diffstat (limited to 'components/profile')
-rw-r--r-- | components/profile/lib.rs | 2 | ||||
-rw-r--r-- | components/profile/mem.rs | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/components/profile/lib.rs b/components/profile/lib.rs index a874ed233bb..08971cb3e0f 100644 --- a/components/profile/lib.rs +++ b/components/profile/lib.rs @@ -5,7 +5,7 @@ #![feature(box_syntax)] #![feature(iter_arith)] #![cfg_attr(target_os="linux", feature(page_size))] -#![feature(slice_extras)] +#![feature(slice_splits)] #[macro_use] extern crate log; diff --git a/components/profile/mem.rs b/components/profile/mem.rs index 00a5c51f14b..ff9a19ecc36 100644 --- a/components/profile/mem.rs +++ b/components/profile/mem.rs @@ -249,14 +249,15 @@ impl ReportsForest { // Insert the path and size into the forest, adding any trees and nodes as necessary. fn insert(&mut self, path: &[String], size: usize) { + let (head, tail) = path.split_first().unwrap(); // Get the right tree, creating it if necessary. - if !self.trees.contains_key(&path[0]) { - self.trees.insert(path[0].clone(), ReportsTree::new(path[0].clone())); + if !self.trees.contains_key(head) { + self.trees.insert(head.clone(), ReportsTree::new(head.clone())); } - let t = self.trees.get_mut(&path[0]).unwrap(); + let t = self.trees.get_mut(head).unwrap(); - // Use tail() because the 0th path segment was used to find the right tree in the forest. - t.insert(path.tail(), size); + // Use tail because the 0th path segment was used to find the right tree in the forest. + t.insert(tail, size); } fn print(&mut self) { |