about summary refs log tree commit diff
path: root/src/libtest/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libtest/stats.rs')
-rw-r--r--src/libtest/stats.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 7087d4c4238..83a178d7b55 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -11,6 +11,7 @@
 #![allow(missing_doc)]
 
 use std::collections::hashmap;
+use std::collections::hashmap::{Occupied, Vacant};
 use std::fmt::Show;
 use std::hash::Hash;
 use std::io;
@@ -443,7 +444,10 @@ pub fn write_boxplot<T: Float + Show + FromPrimitive>(
 pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U, uint> {
     let mut map: hashmap::HashMap<U,uint> = hashmap::HashMap::new();
     for elem in iter {
-        map.insert_or_update_with(elem, 1, |_, count| *count += 1);
+        match map.entry(elem) {
+            Occupied(mut entry) => { *entry.get_mut() += 1; },
+            Vacant(entry) => { entry.set(1); },
+        }
     }
     map
 }