mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
stylo: use FnvHashMap everywhere, remove default HashMap construction methods
This commit is contained in:
parent
0b69887387
commit
8bce37e6ba
7 changed files with 12 additions and 98 deletions
|
@ -583,42 +583,6 @@ impl<K, V, S> HashMap<K, V, S>
|
|||
}
|
||||
}
|
||||
|
||||
impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
|
||||
/// Creates an empty `HashMap`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
/// let mut map: HashMap<&str, isize> = HashMap::new();
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn new() -> HashMap<K, V, RandomState> {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
/// Creates an empty `HashMap` with the specified capacity.
|
||||
///
|
||||
/// The hash map will be able to hold at least `capacity` elements without
|
||||
/// reallocating. If `capacity` is 0, the hash map will not allocate.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
/// let mut map: HashMap<&str, isize> = HashMap::with_capacity(10);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn with_capacity(capacity: usize) -> HashMap<K, V, RandomState> {
|
||||
HashMap::with_capacity_and_hasher(capacity, Default::default())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_with_capacity(capacity: usize) -> Result<HashMap<K, V, RandomState>, FailedAllocationError> {
|
||||
HashMap::try_with_capacity_and_hasher(capacity, Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> HashMap<K, V, S>
|
||||
where K: Eq + Hash,
|
||||
S: BuildHasher
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue