]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_data_structures/thin_vec.rs
Rollup merge of #68424 - estebank:suggest-borrow-for-non-copy-vec, r=davidtwco
[rust.git] / src / librustc_data_structures / thin_vec.rs
index 93a8b7f525fffff540afb00792b30ed6819fc9b7..2befc0aa50487bcffe722061c0dfe0cce226f5ca 100644 (file)
@@ -1,9 +1,9 @@
-use crate::stable_hasher::{StableHasher, 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> {
@@ -14,11 +14,7 @@ pub fn new() -> Self {
 
 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))) }
     }
 }