[test] Add some #[inline]
to HashMap
This commit is contained in:
parent
1af1c2de36
commit
d01427f53e
1 changed files with 3 additions and 0 deletions
|
@ -1113,6 +1113,7 @@ impl<K, V, S> HashMap<K, V, S>
|
||||||
/// assert_eq!(map.get(&2), None);
|
/// assert_eq!(map.get(&2), None);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
#[inline]
|
||||||
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
|
pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
|
||||||
where K: Borrow<Q>,
|
where K: Borrow<Q>,
|
||||||
Q: Hash + Eq
|
Q: Hash + Eq
|
||||||
|
@ -2554,6 +2555,7 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
|
||||||
{
|
{
|
||||||
type Key = K;
|
type Key = K;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn get(&self, key: &Q) -> Option<&K> {
|
fn get(&self, key: &Q) -> Option<&K> {
|
||||||
self.search(key).into_occupied_bucket().map(|bucket| bucket.into_refs().0)
|
self.search(key).into_occupied_bucket().map(|bucket| bucket.into_refs().0)
|
||||||
}
|
}
|
||||||
|
@ -2566,6 +2568,7 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
|
||||||
self.search_mut(key).into_occupied_bucket().map(|bucket| pop_internal(bucket).0)
|
self.search_mut(key).into_occupied_bucket().map(|bucket| pop_internal(bucket).0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn replace(&mut self, key: K) -> Option<K> {
|
fn replace(&mut self, key: K) -> Option<K> {
|
||||||
self.reserve(1);
|
self.reserve(1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue