]> piware.de Git - learn-rust.git/blobdiff - src/main.rs
Consistently use into_iter() with collect()
[learn-rust.git] / src / main.rs
index 0ef1b16f4f9b19c7e9e1c71377abd4273acc0d1b..3b45c882984a49f2d4303543fba86b80b0f38b53 100644 (file)
@@ -65,7 +65,7 @@ fn test_hashmaps() {
     println!("scores after doubling: {:?}", scores);
 
     // double scores of immutable hashmap (rebuild it)
-    let collect_scores: HashMap<_, _> = collect_scores.iter()
+    let collect_scores: HashMap<_, _> = collect_scores.into_iter()
         .map(|(k, v)| (k, 2 * v))
         .collect();
     println!("collect_scores after rebuilding with doubling: {:?}", collect_scores);