Skip to content

Commit 8a011b5

Browse files
committed
minor doc changes, attribute orderings
1 parent e0bc267 commit 8a011b5

File tree

1 file changed

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

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,8 @@ impl<K, V, S> HashMap<K, V, S> {
554554
/// a.clear();
555555
/// assert!(a.is_empty());
556556
/// ```
557-
#[stable(feature = "rust1", since = "1.0.0")]
558557
#[inline]
558+
#[stable(feature = "rust1", since = "1.0.0")]
559559
pub fn clear(&mut self) {
560560
self.base.clear();
561561
}
@@ -746,8 +746,8 @@ where
746746
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
747747
/// assert_eq!(map.get_key_value(&2), None);
748748
/// ```
749-
#[stable(feature = "map_get_key_value", since = "1.40.0")]
750749
#[inline]
750+
#[stable(feature = "map_get_key_value", since = "1.40.0")]
751751
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
752752
where
753753
K: Borrow<Q>,
@@ -772,8 +772,8 @@ where
772772
/// assert_eq!(map.contains_key(&1), true);
773773
/// assert_eq!(map.contains_key(&2), false);
774774
/// ```
775-
#[stable(feature = "rust1", since = "1.0.0")]
776775
#[inline]
776+
#[stable(feature = "rust1", since = "1.0.0")]
777777
pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
778778
where
779779
K: Borrow<Q>,
@@ -800,8 +800,8 @@ where
800800
/// }
801801
/// assert_eq!(map[&1], "b");
802802
/// ```
803-
#[stable(feature = "rust1", since = "1.0.0")]
804803
#[inline]
804+
#[stable(feature = "rust1", since = "1.0.0")]
805805
pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
806806
where
807807
K: Borrow<Q>,
@@ -834,8 +834,8 @@ where
834834
/// assert_eq!(map.insert(37, "c"), Some("b"));
835835
/// assert_eq!(map[&37], "c");
836836
/// ```
837-
#[stable(feature = "rust1", since = "1.0.0")]
838837
#[inline]
838+
#[stable(feature = "rust1", since = "1.0.0")]
839839
pub fn insert(&mut self, k: K, v: V) -> Option<V> {
840840
self.base.insert(k, v)
841841
}
@@ -857,8 +857,8 @@ where
857857
/// assert_eq!(map.remove(&1), Some("a"));
858858
/// assert_eq!(map.remove(&1), None);
859859
/// ```
860-
#[stable(feature = "rust1", since = "1.0.0")]
861860
#[inline]
861+
#[stable(feature = "rust1", since = "1.0.0")]
862862
pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
863863
where
864864
K: Borrow<Q>,
@@ -886,8 +886,8 @@ where
886886
/// assert_eq!(map.remove(&1), None);
887887
/// # }
888888
/// ```
889-
#[stable(feature = "hash_map_remove_entry", since = "1.27.0")]
890889
#[inline]
890+
#[stable(feature = "hash_map_remove_entry", since = "1.27.0")]
891891
pub fn remove_entry<Q: ?Sized>(&mut self, k: &Q) -> Option<(K, V)>
892892
where
893893
K: Borrow<Q>,
@@ -909,8 +909,8 @@ where
909909
/// map.retain(|&k, _| k % 2 == 0);
910910
/// assert_eq!(map.len(), 4);
911911
/// ```
912-
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
913912
#[inline]
913+
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
914914
pub fn retain<F>(&mut self, f: F)
915915
where
916916
F: FnMut(&K, &mut V) -> bool,
@@ -1542,7 +1542,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
15421542
self.base.get()
15431543
}
15441544

1545-
/// Converts the OccupiedEntry into a mutable reference to the value in the entry
1545+
/// Converts the `OccupiedEntry` into a mutable reference to the value in the entry
15461546
/// with a lifetime bound to the map itself.
15471547
#[inline]
15481548
#[unstable(feature = "hash_raw_entry", issue = "56167")]
@@ -1571,7 +1571,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
15711571
self.base.get_key_value_mut()
15721572
}
15731573

1574-
/// Converts the OccupiedEntry into a mutable reference to the key and value in the entry
1574+
/// Converts the `OccupiedEntry` into a mutable reference to the key and value in the entry
15751575
/// with a lifetime bound to the map itself.
15761576
#[inline]
15771577
#[unstable(feature = "hash_raw_entry", issue = "56167")]
@@ -1609,7 +1609,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
16091609
}
16101610

16111611
impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
1612-
/// Sets the value of the entry with the VacantEntry's key,
1612+
/// Sets the value of the entry with the `VacantEntry`'s key,
16131613
/// and returns a mutable reference to it.
16141614
#[inline]
16151615
#[unstable(feature = "hash_raw_entry", issue = "56167")]
@@ -2072,7 +2072,6 @@ where
20722072
}
20732073

20742074
impl<'a, K, V> Entry<'a, K, V> {
2075-
#[stable(feature = "rust1", since = "1.0.0")]
20762075
/// Ensures a value is in the entry by inserting the default if empty, and returns
20772076
/// a mutable reference to the value in the entry.
20782077
///
@@ -2090,14 +2089,14 @@ impl<'a, K, V> Entry<'a, K, V> {
20902089
/// assert_eq!(map["poneyland"], 6);
20912090
/// ```
20922091
#[inline]
2092+
#[stable(feature = "rust1", since = "1.0.0")]
20932093
pub fn or_insert(self, default: V) -> &'a mut V {
20942094
match self {
20952095
Occupied(entry) => entry.into_mut(),
20962096
Vacant(entry) => entry.insert(default),
20972097
}
20982098
}
20992099

2100-
#[stable(feature = "rust1", since = "1.0.0")]
21012100
/// Ensures a value is in the entry by inserting the result of the default function if empty,
21022101
/// and returns a mutable reference to the value in the entry.
21032102
///
@@ -2114,14 +2113,14 @@ impl<'a, K, V> Entry<'a, K, V> {
21142113
/// assert_eq!(map["poneyland"], "hoho".to_string());
21152114
/// ```
21162115
#[inline]
2116+
#[stable(feature = "rust1", since = "1.0.0")]
21172117
pub fn or_insert_with<F: FnOnce() -> V>(self, default: F) -> &'a mut V {
21182118
match self {
21192119
Occupied(entry) => entry.into_mut(),
21202120
Vacant(entry) => entry.insert(default()),
21212121
}
21222122
}
21232123

2124-
#[unstable(feature = "or_insert_with_key", issue = "71024")]
21252124
/// Ensures a value is in the entry by inserting, if empty, the result of the default function,
21262125
/// which takes the key as its argument, and returns a mutable reference to the value in the
21272126
/// entry.
@@ -2139,6 +2138,7 @@ impl<'a, K, V> Entry<'a, K, V> {
21392138
/// assert_eq!(map["poneyland"], 9);
21402139
/// ```
21412140
#[inline]
2141+
#[unstable(feature = "or_insert_with_key", issue = "71024")]
21422142
pub fn or_insert_with_key<F: FnOnce(&K) -> V>(self, default: F) -> &'a mut V {
21432143
match self {
21442144
Occupied(entry) => entry.into_mut(),
@@ -2203,7 +2203,7 @@ impl<'a, K, V> Entry<'a, K, V> {
22032203
}
22042204
}
22052205

2206-
/// Sets the value of the entry, and returns an OccupiedEntry.
2206+
/// Sets the value of the entry, and returns an `OccupiedEntry`.
22072207
///
22082208
/// # Examples
22092209
///
@@ -2230,7 +2230,6 @@ impl<'a, K, V> Entry<'a, K, V> {
22302230
}
22312231

22322232
impl<'a, K, V: Default> Entry<'a, K, V> {
2233-
#[stable(feature = "entry_or_default", since = "1.28.0")]
22342233
/// Ensures a value is in the entry by inserting the default value if empty,
22352234
/// and returns a mutable reference to the value in the entry.
22362235
///
@@ -2247,6 +2246,7 @@ impl<'a, K, V: Default> Entry<'a, K, V> {
22472246
/// # }
22482247
/// ```
22492248
#[inline]
2249+
#[stable(feature = "entry_or_default", since = "1.28.0")]
22502250
pub fn or_default(self) -> &'a mut V {
22512251
match self {
22522252
Occupied(entry) => entry.into_mut(),
@@ -2351,7 +2351,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
23512351
self.base.get_mut()
23522352
}
23532353

2354-
/// Converts the OccupiedEntry into a mutable reference to the value in the entry
2354+
/// Converts the `OccupiedEntry` into a mutable reference to the value in the entry
23552355
/// with a lifetime bound to the map itself.
23562356
///
23572357
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
@@ -2523,7 +2523,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
25232523
self.base.into_key()
25242524
}
25252525

2526-
/// Sets the value of the entry with the VacantEntry's key,
2526+
/// Sets the value of the entry with the `VacantEntry`'s key,
25272527
/// and returns a mutable reference to it.
25282528
///
25292529
/// # Examples
@@ -2545,8 +2545,8 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
25452545
self.base.insert(value)
25462546
}
25472547

2548-
/// Sets the value of the entry with the VacantEntry's key,
2549-
/// and returns an OccupiedEntry.
2548+
/// Sets the value of the entry with the `VacantEntry`'s key,
2549+
/// and returns an `OccupiedEntry`.
25502550
///
25512551
/// # Examples
25522552
///

0 commit comments

Comments
 (0)