]> piware.de Git - learn-rust.git/commitdiff
Consistently use into_iter() with collect()
authorMartin Pitt <martin@piware.de>
Thu, 26 Aug 2021 15:23:55 +0000 (17:23 +0200)
committerMartin Pitt <martin@piware.de>
Thu, 26 Aug 2021 15:23:55 +0000 (17:23 +0200)
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);