Skip to content

Commit 709f184

Browse files
authored
Rollup merge of #113153 - tshepang:patch-6, r=cuviper
make HashMap::or_insert_with example more simple
2 parents 4e8f135 + 5b46aa1 commit 709f184

File tree

1 file changed

+4
-4
lines changed
  • library/std/src/collections/hash

1 file changed

+4
-4
lines changed

library/std/src/collections/hash/map.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2543,12 +2543,12 @@ impl<'a, K, V> Entry<'a, K, V> {
25432543
/// ```
25442544
/// use std::collections::HashMap;
25452545
///
2546-
/// let mut map: HashMap<&str, String> = HashMap::new();
2547-
/// let s = "hoho".to_string();
2546+
/// let mut map = HashMap::new();
2547+
/// let value = "hoho";
25482548
///
2549-
/// map.entry("poneyland").or_insert_with(|| s);
2549+
/// map.entry("poneyland").or_insert_with(|| value);
25502550
///
2551-
/// assert_eq!(map["poneyland"], "hoho".to_string());
2551+
/// assert_eq!(map["poneyland"], "hoho");
25522552
/// ```
25532553
#[inline]
25542554
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)