about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-08-30 11:42:16 +0200
committerljedrz <ljedrz@gmail.com>2018-09-26 10:43:37 +0200
commit130a32fa7259d348dc3a684b38e688da398c30bb (patch)
treefdac0e731215a273252f93254690a37d2c77fc25 /src/librustc_data_structures
parentbeff387601fef141e7b6716a6cd50728d079a0c1 (diff)
downloadrust-130a32fa7259d348dc3a684b38e688da398c30bb.tar.gz
rust-130a32fa7259d348dc3a684b38e688da398c30bb.zip
Remove OneVector
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/lib.rs2
-rw-r--r--src/librustc_data_structures/small_vec.rs55
2 files changed, 0 insertions, 57 deletions
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index 70b960ac351..43ab3869806 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -50,7 +50,6 @@ extern crate rustc_rayon as rayon;
 extern crate rustc_rayon_core as rayon_core;
 extern crate rustc_hash;
 extern crate serialize;
-#[cfg_attr(test, macro_use)]
 extern crate smallvec;
 
 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
@@ -72,7 +71,6 @@ pub mod owning_ref;
 pub mod ptr_key;
 pub mod sip128;
 pub mod small_c_str;
-pub mod small_vec;
 pub mod snapshot_map;
 pub use ena::snapshot_vec;
 pub mod sorted_map;
diff --git a/src/librustc_data_structures/small_vec.rs b/src/librustc_data_structures/small_vec.rs
deleted file mode 100644
index 075b70c6426..00000000000
--- a/src/librustc_data_structures/small_vec.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! A vector type intended to be used for small vectors.
-//!
-//! Space for up to N elements is provided on the stack. If more elements are collected, Vec is
-//! used to store the values on the heap.
-//!
-//! The N above is determined by Array's implementor, by way of an associated constant.
-
-use smallvec::{Array, SmallVec};
-
-pub type OneVector<T> = SmallVec<[T; 1]>;
-
-pub trait ExpectOne<A: Array> {
-    fn expect_one(self, err: &'static str) -> A::Item;
-}
-
-impl<A: Array> ExpectOne<A> for SmallVec<A> {
-    fn expect_one(self, err: &'static str) -> A::Item {
-        assert!(self.len() == 1, err);
-        self.into_iter().next().unwrap()
-    }
-}
-
-#[cfg(test)]
-mod tests {
-    extern crate test;
-    use super::*;
-
-    #[test]
-    #[should_panic]
-    fn test_expect_one_zero() {
-        let _: isize = OneVector::new().expect_one("");
-    }
-
-    #[test]
-    #[should_panic]
-    fn test_expect_one_many() {
-        OneVector::from_vec(vec![1, 2]).expect_one("");
-    }
-
-    #[test]
-    fn test_expect_one_one() {
-        assert_eq!(1, (smallvec![1] as OneVector<_>).expect_one(""));
-        assert_eq!(1, OneVector::from_vec(vec![1]).expect_one(""));
-    }
-}