Skip to content

Commit d3de465

Browse files
committed
Addressed @BurntSuchi's remarks regarding Entry::replace
1 parent a312b47 commit d3de465

File tree

1 file changed

+3
-4
lines changed
  • src/libstd/collections/hash

1 file changed

+3
-4
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,21 +2167,20 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
21672167
/// # Examples
21682168
///
21692169
/// ```
2170-
/// # #![feature(map_entry_replace)]
2170+
/// #![feature(map_entry_replace)]
21712171
/// use std::collections::HashMap;
21722172
/// use std::collections::hash_map::Entry;
21732173
///
21742174
/// let mut map: HashMap<String, u32> = HashMap::new();
2175-
/// map.insert(String::from("poneyland"), 15);
2175+
/// map.insert("poneyland".to_string(), 15);
21762176
///
2177-
/// if let Entry::Occupied(entry) = map.entry(String::from("poneyland")) {
2177+
/// if let Entry::Occupied(entry) = map.entry("poneyland".to_string()) {
21782178
/// let (old_key, old_value): (String, u32) = entry.replace(16);
21792179
/// assert_eq!(old_key, "poneyland");
21802180
/// assert_eq!(old_value, 15);
21812181
/// }
21822182
///
21832183
/// assert_eq!(map.get("poneyland"), Some(&16));
2184-
///
21852184
/// ```
21862185
#[unstable(feature = "map_entry_replace", issue = "44286")]
21872186
pub fn replace(mut self, value: V) -> (K, V) {

0 commit comments

Comments
 (0)