Avoid weird or_insert_with example
This commit is contained in:
@@ -2116,9 +2116,7 @@ impl<'a, K: Ord, V: Default> Entry<'a, K, V> {
|
|||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// use std::collections::BTreeMap;
|
/// use std::collections::BTreeMap;
|
||||||
///
|
///
|
||||||
/// let mut map: BTreeMap<&str, String> = BTreeMap::new();
|
/// let mut map: BTreeMap<&str, Option<usize>> = BTreeMap::new();
|
||||||
/// let s = "hoho".to_string();
|
|
||||||
///
|
|
||||||
/// map.entry("poneyland").or_default();
|
/// map.entry("poneyland").or_default();
|
||||||
///
|
///
|
||||||
/// assert_eq!(map["poneyland"], None);
|
/// assert_eq!(map["poneyland"], None);
|
||||||
|
|||||||
@@ -2013,9 +2013,7 @@ impl<'a, K, V: Default> Entry<'a, K, V> {
|
|||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// use std::collections::HashMap;
|
/// use std::collections::HashMap;
|
||||||
///
|
///
|
||||||
/// let mut map: HashMap<&str, Option<usize>> = HashMap::new();
|
/// let mut map: HashMap<&str, Option<u32>> = HashMap::new();
|
||||||
/// let s = "hoho".to_string();
|
|
||||||
///
|
|
||||||
/// map.entry("poneyland").or_default();
|
/// map.entry("poneyland").or_default();
|
||||||
///
|
///
|
||||||
/// assert_eq!(map["poneyland"], None);
|
/// assert_eq!(map["poneyland"], None);
|
||||||
|
|||||||
Reference in New Issue
Block a user