Skip to content

Commit bf03d12

Browse files
committed
fix example in summary
1 parent 74391a7 commit bf03d12

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

text/0000-entry-into-owned.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ borrows. In effect, it makes the following possible:
1818

1919
// ...
2020

21-
*string_map.entry("foo").or_insert(0) += 1; // Clones if "foo" not in map.
22-
*string_map.entry("bar".to_string()) += 1; // By-value, never clones.
21+
*string_map.entry("foo").or_insert(0) += 1; // Clones if "foo" not in map.
22+
*string_map.entry("bar".to_string()).or_insert(0) += 1; // By-value, never clones.
2323

24-
clone_map.entry(&Cloneable::new()); // Clones if key not in map.
25-
clone_map.entry(Cloneable::new()); // By-value, never clones.
24+
*clone_map.entry(&Cloneable::new()).or_insert(0) += 1; // Clones if key not in map.
25+
*clone_map.entry(Cloneable::new()).or_insert(0) += 1; // By-value, never clones.
2626

27-
nonclone_map.entry(NonCloneable::new()); // Can't and doesn't clone.
27+
*nonclone_map.entry(NonCloneable::new()).or_insert(0) += 1; // Can't and doesn't clone.
2828
```
2929

3030
See [playground](https://is.gd/0lpGej) for a concrete demonstration.

0 commit comments

Comments
 (0)