Skip to content

Commit e0e0b3f

Browse files
authored
Merge pull request #1432 from ryanwhitehouse/main
docs:clarify instructions on hashmaps2.rs
2 parents b21a4ac + 864e741 commit e0e0b3f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

exercises/hashmaps/hashmaps2.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// hashmaps2.rs
2-
3-
// A basket of fruits in the form of a hash map is given. The key
4-
// represents the name of the fruit and the value represents how many
5-
// of that particular fruit is in the basket. You have to put *MORE
6-
// THAN 11* fruits in the basket. Three types of fruits - Apple (4),
7-
// Mango (2) and Lychee (5) are already given in the basket. You are
8-
// not allowed to insert any more of these fruits!
2+
// We're collecting different fruits to bake a delicious fruit cake.
3+
// For this, we have a basket, which we'll represent in the form of a hash
4+
// map. The key represents the name of each fruit we collect and the value
5+
// represents how many of that particular fruit we have collected.
6+
// Three types of fruits - Apple (4), Mango (2) and Lychee (5) are already
7+
// in the basket hash map.
8+
// You must add fruit to the basket so that there is at least
9+
// one of each kind and more than 11 in total - we have a lot of mouths to feed.
10+
// You are not allowed to insert any more of these fruits!
911
//
1012
// Make me pass the tests!
1113
//
@@ -34,8 +36,8 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
3436
];
3537

3638
for fruit in fruit_kinds {
37-
// TODO: Put new fruits if not already present. Note that you
38-
// are not allowed to put any type of fruit that's already
39+
// TODO: Insert new fruits if they are not already present in the basket.
40+
// Note that you are not allowed to put any type of fruit that's already
3941
// present!
4042
}
4143
}
@@ -44,6 +46,7 @@ fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
4446
mod tests {
4547
use super::*;
4648

49+
// Don't modify this function!
4750
fn get_fruit_basket() -> HashMap<Fruit, u32> {
4851
let mut basket = HashMap::<Fruit, u32>::new();
4952
basket.insert(Fruit::Apple, 4);

0 commit comments

Comments
 (0)