-use crate::stable_hasher::{StableHasher, StableHasherResult, HashStable};
+use crate::stable_hasher::{HashStable, StableHasher};
/// A vector type optimized for cases where this size is usually 0 (cf. `SmallVector`).
/// The `Option<Box<..>>` wrapping allows us to represent a zero sized vector with `None`,
/// which uses only a single (null) pointer.
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
pub struct ThinVec<T>(Option<Box<Vec<T>>>);
impl<T> ThinVec<T> {
impl<T> From<Vec<T>> for ThinVec<T> {
fn from(vec: Vec<T>) -> Self {
- if vec.is_empty() {
- ThinVec(None)
- } else {
- ThinVec(Some(Box::new(vec)))
- }
+ if vec.is_empty() { ThinVec(None) } else { ThinVec(Some(Box::new(vec))) }
}
}
}
impl<T: HashStable<CTX>, CTX> HashStable<CTX> for ThinVec<T> {
- fn hash_stable<W: StableHasherResult>(&self,
- hcx: &mut CTX,
- hasher: &mut StableHasher<W>) {
+ fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
(**self).hash_stable(hcx, hasher)
}
}