From 00bdae02fdbb2e27e4d27a54683537faa33b3f17 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Tue, 5 Sep 2017 13:37:36 -0400 Subject: [PATCH] Avoid weird or_insert_with example --- src/liballoc/btree/map.rs | 4 +--- src/libstd/collections/hash/map.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/liballoc/btree/map.rs b/src/liballoc/btree/map.rs index 0adfaf3be8f2..4c93fead1723 100644 --- a/src/liballoc/btree/map.rs +++ b/src/liballoc/btree/map.rs @@ -2116,9 +2116,7 @@ impl<'a, K: Ord, V: Default> Entry<'a, K, V> { /// # fn main() { /// use std::collections::BTreeMap; /// - /// let mut map: BTreeMap<&str, String> = BTreeMap::new(); - /// let s = "hoho".to_string(); - /// + /// let mut map: BTreeMap<&str, Option> = BTreeMap::new(); /// map.entry("poneyland").or_default(); /// /// assert_eq!(map["poneyland"], None); diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 36399067a12c..fbb69ca97493 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -2013,9 +2013,7 @@ impl<'a, K, V: Default> Entry<'a, K, V> { /// # fn main() { /// use std::collections::HashMap; /// - /// let mut map: HashMap<&str, Option> = HashMap::new(); - /// let s = "hoho".to_string(); - /// + /// let mut map: HashMap<&str, Option> = HashMap::new(); /// map.entry("poneyland").or_default(); /// /// assert_eq!(map["poneyland"], None);