summaryrefslogtreecommitdiff
path: root/rustlings-macros
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-10-17 14:37:47 +0200
committermo8it <mo8it@proton.me>2024-10-17 14:49:07 +0200
commitf146553dead78357cd44736dfca97b1349418fa2 (patch)
treecc08d5b5f025acb620b755971e37cb1da0b8cf38 /rustlings-macros
parent0432e07864d5ee4d2bac1954c965b2077c0447c6 (diff)
hashmap3: Use `or_default`
Diffstat (limited to 'rustlings-macros')
-rw-r--r--rustlings-macros/info.toml8
1 files changed, 2 insertions, 6 deletions
diff --git a/rustlings-macros/info.toml b/rustlings-macros/info.toml
index c1342d6..e705598 100644
--- a/rustlings-macros/info.toml
+++ b/rustlings-macros/info.toml
@@ -575,12 +575,8 @@ https://doc.rust-lang.org/book/ch08-03-hash-maps.html#only-inserting-a-value-if-
name = "hashmaps3"
dir = "11_hashmaps"
hint = """
-Hint 1: Use the `entry()` and `or_insert()` (or `or_insert_with()`) methods of
- `HashMap` to insert the default value of `TeamScores` if a team doesn't
- exist in the table yet.
-
-Learn more in The Book:
-https://doc.rust-lang.org/book/ch08-03-hash-maps.html#only-inserting-a-value-if-the-key-has-no-value
+Hint 1: Use the `entry()` and `or_default()` methods of `HashMap` to insert the
+ default value of `TeamScores` if a team doesn't exist in the table yet.
Hint 2: If there is already an entry for a given key, the value returned by
`entry()` can be updated based on the existing value.