style: Back out ordermap.

It was worth a shot!
This commit is contained in:
Emilio Cobos Álvarez 2018-02-12 12:20:46 +01:00
parent 9c94fe4279
commit 25868beabd
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 3 additions and 384 deletions

View file

@ -49,7 +49,6 @@ extern crate euclid;
extern crate hashglobe;
#[cfg(feature = "servo")]
extern crate mozjs as js;
extern crate ordermap;
extern crate selectors;
extern crate servo_arc;
extern crate smallbitvec;
@ -412,33 +411,6 @@ impl<T, S> MallocShallowSizeOf for hashglobe::hash_set::HashSet<T, S>
}
}
impl<T, S> MallocSizeOf for ordermap::OrderSet<T, S>
where T: Eq + Hash + MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = self.shallow_size_of(ops);
for t in self.iter() {
n += t.size_of(ops);
}
n
}
}
impl<T, S> MallocShallowSizeOf for ordermap::OrderSet<T, S>
where T: Eq + Hash,
S: BuildHasher
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// See the implementation for std::collections::HashSet for details.
if ops.has_malloc_enclosing_size_of() {
self.iter().next().map_or(0, |t| unsafe { ops.malloc_enclosing_size_of(t) })
} else {
self.capacity() * (size_of::<T>() + size_of::<usize>())
}
}
}
impl<T, S> MallocSizeOf for hashglobe::hash_set::HashSet<T, S>
where T: Eq + Hash + MallocSizeOf,
S: BuildHasher,
@ -472,26 +444,6 @@ impl<T, S> MallocSizeOf for hashglobe::fake::HashSet<T, S>
}
}
impl<T, S> MallocShallowSizeOf for hashglobe::order::HashSet<T, S>
where T: Eq + Hash,
S: BuildHasher,
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().shallow_size_of(ops)
}
}
impl<T, S> MallocSizeOf for hashglobe::order::HashSet<T, S>
where T: Eq + Hash + MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().size_of(ops)
}
}
impl<K, V, S> MallocShallowSizeOf for std::collections::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher
@ -521,35 +473,6 @@ impl<K, V, S> MallocSizeOf for std::collections::HashMap<K, V, S>
}
}
impl<K, V, S> MallocShallowSizeOf for ordermap::OrderMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
// See the implementation for std::collections::HashSet for details.
if ops.has_malloc_enclosing_size_of() {
self.values().next().map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
} else {
self.capacity() * (size_of::<V>() + size_of::<K>() + size_of::<usize>())
}
}
}
impl<K, V, S> MallocSizeOf for ordermap::OrderMap<K, V, S>
where K: Eq + Hash + MallocSizeOf,
V: MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
let mut n = self.shallow_size_of(ops);
for (k, v) in self.iter() {
n += k.size_of(ops);
n += v.size_of(ops);
}
n
}
}
impl<K, V, S> MallocShallowSizeOf for hashglobe::hash_map::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher
@ -600,27 +523,6 @@ impl<K, V, S> MallocSizeOf for hashglobe::fake::HashMap<K, V, S>
}
}
impl<K, V, S> MallocShallowSizeOf for hashglobe::order::HashMap<K, V, S>
where K: Eq + Hash,
S: BuildHasher,
{
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().shallow_size_of(ops)
}
}
impl<K, V, S> MallocSizeOf for hashglobe::order::HashMap<K, V, S>
where K: Eq + Hash + MallocSizeOf,
V: MallocSizeOf,
S: BuildHasher,
{
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
use std::ops::Deref;
self.deref().size_of(ops)
}
}
// PhantomData is always 0.
impl<T> MallocSizeOf for std::marker::PhantomData<T> {
fn size_of(&self, _ops: &mut MallocSizeOfOps) -> usize {