mirror of
https://github.com/servo/servo.git
synced 2025-07-19 05:13:55 +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
|
@ -121,38 +121,6 @@ pub struct HashSet<T, S = RandomState> {
|
|||
map: HashMap<T, (), S>,
|
||||
}
|
||||
|
||||
impl<T: Hash + Eq> HashSet<T, RandomState> {
|
||||
/// Creates an empty `HashSet`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let set: HashSet<i32> = HashSet::new();
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn new() -> HashSet<T, RandomState> {
|
||||
HashSet { map: HashMap::new() }
|
||||
}
|
||||
|
||||
/// Creates an empty `HashSet` with the specified capacity.
|
||||
///
|
||||
/// The hash set will be able to hold at least `capacity` elements without
|
||||
/// reallocating. If `capacity` is 0, the hash set will not allocate.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let set: HashSet<i32> = HashSet::with_capacity(10);
|
||||
/// assert!(set.capacity() >= 10);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn with_capacity(capacity: usize) -> HashSet<T, RandomState> {
|
||||
HashSet { map: HashMap::with_capacity(capacity) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S> HashSet<T, S>
|
||||
where T: Eq + Hash,
|
||||
S: BuildHasher
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue