Skip to content

Commit 2be69b0

Browse files
committed
fix for a couple of small issues I came accross whilst doing the exercise
1 parent dd0634c commit 2be69b0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

exercises/11_hashmaps/hashmaps2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ mod tests {
4646
// Don't modify this function!
4747
fn get_fruit_basket() -> HashMap<Fruit, u32> {
4848
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
49-
HashMap::from_iter(content)
49+
HashMap::from(content)
5050
}
5151

5252
#[test]
@@ -89,7 +89,7 @@ mod tests {
8989

9090
for fruit_kind in fruit_kinds {
9191
let Some(amount) = basket.get(&fruit_kind) else {
92-
panic!("Fruit kind {fruit_kind:?} was not found in basket");
92+
panic!("Fruit kind {:?} was not found in basket", fruit_kind);
9393
};
9494
assert!(*amount > 0);
9595
}

solutions/11_hashmaps/hashmaps2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod tests {
4545
// Don't modify this function!
4646
fn get_fruit_basket() -> HashMap<Fruit, u32> {
4747
let content = [(Fruit::Apple, 4), (Fruit::Mango, 2), (Fruit::Lychee, 5)];
48-
HashMap::from_iter(content)
48+
HashMap::from(content)
4949
}
5050

5151
#[test]
@@ -88,7 +88,7 @@ mod tests {
8888

8989
for fruit_kind in fruit_kinds {
9090
let Some(amount) = basket.get(&fruit_kind) else {
91-
panic!("Fruit kind {fruit_kind:?} was not found in basket");
91+
panic!("Fruit kind {:?} was not found in basket", fruit_kind);
9292
};
9393
assert!(*amount > 0);
9494
}

0 commit comments

Comments
 (0)