From 2be69b0f8ba991d1dce447bd3bf6802a3b382ece Mon Sep 17 00:00:00 2001 From: markharley12 <16harleym@gmail.com> Date: Fri, 15 Nov 2024 20:44:38 +0000 Subject: [PATCH] fix for a couple of small issues I came accross whilst doing the exercise --- exercises/11_hashmaps/hashmaps2.rs | 4 ++-- solutions/11_hashmaps/hashmaps2.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/11_hashmaps/hashmaps2.rs b/exercises/11_hashmaps/hashmaps2.rs index e9f53fea..a2689bf3 100644 --- a/exercises/11_hashmaps/hashmaps2.rs +++ b/exercises/11_hashmaps/hashmaps2.rs @@ -46,7 +46,7 @@ mod tests { // Don't modify this function! fn get_fruit_basket() -> HashMap { let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)]; - HashMap::from_iter(content) + HashMap::from(content) } #[test] @@ -89,7 +89,7 @@ mod tests { for fruit_kind in fruit_kinds { let Some(amount) = basket.get(&fruit_kind) else { - panic!("Fruit kind {fruit_kind:?} was not found in basket"); + panic!("Fruit kind {:?} was not found in basket", fruit_kind); }; assert!(*amount > 0); } diff --git a/solutions/11_hashmaps/hashmaps2.rs b/solutions/11_hashmaps/hashmaps2.rs index 75e6ec2c..4a56fc84 100644 --- a/solutions/11_hashmaps/hashmaps2.rs +++ b/solutions/11_hashmaps/hashmaps2.rs @@ -45,7 +45,7 @@ mod tests { // Don't modify this function! fn get_fruit_basket() -> HashMap { let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)]; - HashMap::from_iter(content) + HashMap::from(content) } #[test] @@ -88,7 +88,7 @@ mod tests { for fruit_kind in fruit_kinds { let Some(amount) = basket.get(&fruit_kind) else { - panic!("Fruit kind {fruit_kind:?} was not found in basket"); + panic!("Fruit kind {:?} was not found in basket", fruit_kind); }; assert!(*amount > 0); }