Skip to content

Commit

Permalink
Update btree_map::VacantEntry::insert docs to actually call insert
Browse files Browse the repository at this point in the history
It looks like they were copied from the `or_insert` docs. This change
makes the example more like the hash_map::VacantEntry::insert docs.
  • Loading branch information
carols10cents committed May 4, 2020
1 parent 649b632 commit d02128f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/liballoc/collections/btree/map.rs
Expand Up @@ -2499,15 +2499,14 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
///
/// ```
/// use std::collections::BTreeMap;
/// use std::collections::btree_map::Entry;
///
/// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
/// let mut map: BTreeMap<&str, u32> = BTreeMap::new();
///
/// // count the number of occurrences of letters in the vec
/// for x in vec!["a","b","a","c","a","b"] {
/// *count.entry(x).or_insert(0) += 1;
/// if let Entry::Vacant(o) = map.entry("poneyland") {
/// o.insert(37);
/// }
///
/// assert_eq!(count["a"], 3);
/// assert_eq!(map["poneyland"], 37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(self, value: V) -> &'a mut V {
Expand Down

0 comments on commit d02128f

Please sign in to comment.