about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2016-05-22 23:57:13 +0530
committerSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>2016-05-22 23:57:13 +0530
commit3d9d96b6da21579e87db3537b7e6dcf3f517b2a7 (patch)
treedc7adedc9610ebd3eb1967face85c4ddec0eb11b
parentda41920919ef4164c91541b8da501e36e9544c0f (diff)
downloadrust-3d9d96b6da21579e87db3537b7e6dcf3f517b2a7.tar.gz
rust-3d9d96b6da21579e87db3537b7e6dcf3f517b2a7.zip
run rustfmt on libcollections test module
-rw-r--r--src/libcollectionstest/btree/map.rs118
-rw-r--r--src/libcollectionstest/enum_set.rs115
-rw-r--r--src/libcollectionstest/linked_list.rs45
-rw-r--r--src/libcollectionstest/slice.rs366
-rw-r--r--src/libcollectionstest/string.rs117
-rw-r--r--src/libcollectionstest/vec.rs56
-rw-r--r--src/libcollectionstest/vec_deque.rs129
7 files changed, 522 insertions, 424 deletions
diff --git a/src/libcollectionstest/btree/map.rs b/src/libcollectionstest/btree/map.rs
index 1858791776f..e19090c7599 100644
--- a/src/libcollectionstest/btree/map.rs
+++ b/src/libcollectionstest/btree/map.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::collections::BTreeMap;
-use std::collections::Bound::{Excluded, Included, Unbounded, self};
+use std::collections::Bound::{self, Excluded, Included, Unbounded};
 use std::collections::btree_map::Entry::{Occupied, Vacant};
 use std::rc::Rc;
 
@@ -20,41 +20,41 @@ fn test_basic_large() {
     assert_eq!(map.len(), 0);
 
     for i in 0..size {
-        assert_eq!(map.insert(i, 10*i), None);
+        assert_eq!(map.insert(i, 10 * i), None);
         assert_eq!(map.len(), i + 1);
     }
 
     for i in 0..size {
-        assert_eq!(map.get(&i).unwrap(), &(i*10));
+        assert_eq!(map.get(&i).unwrap(), &(i * 10));
     }
 
-    for i in size..size*2 {
+    for i in size..size * 2 {
         assert_eq!(map.get(&i), None);
     }
 
     for i in 0..size {
-        assert_eq!(map.insert(i, 100*i), Some(10*i));
+        assert_eq!(map.insert(i, 100 * i), Some(10 * i));
         assert_eq!(map.len(), size);
     }
 
     for i in 0..size {
-        assert_eq!(map.get(&i).unwrap(), &(i*100));
+        assert_eq!(map.get(&i).unwrap(), &(i * 100));
     }
 
-    for i in 0..size/2 {
-        assert_eq!(map.remove(&(i*2)), Some(i*200));
+    for i in 0..size / 2 {
+        assert_eq!(map.remove(&(i * 2)), Some(i * 200));
         assert_eq!(map.len(), size - i - 1);
     }
 
-    for i in 0..size/2 {
-        assert_eq!(map.get(&(2*i)), None);
-        assert_eq!(map.get(&(2*i+1)).unwrap(), &(i*200 + 100));
+    for i in 0..size / 2 {
+        assert_eq!(map.get(&(2 * i)), None);
+        assert_eq!(map.get(&(2 * i + 1)).unwrap(), &(i * 200 + 100));
     }
 
-    for i in 0..size/2 {
-        assert_eq!(map.remove(&(2*i)), None);
-        assert_eq!(map.remove(&(2*i+1)), Some(i*200 + 100));
-        assert_eq!(map.len(), size/2 - i - 1);
+    for i in 0..size / 2 {
+        assert_eq!(map.remove(&(2 * i)), None);
+        assert_eq!(map.remove(&(2 * i + 1)), Some(i * 200 + 100));
+        assert_eq!(map.len(), size / 2 - i - 1);
     }
 }
 
@@ -81,7 +81,9 @@ fn test_iter() {
     // Forwards
     let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-    fn test<T>(size: usize, mut iter: T) where T: Iterator<Item=(usize, usize)> {
+    fn test<T>(size: usize, mut iter: T)
+        where T: Iterator<Item = (usize, usize)>
+    {
         for i in 0..size {
             assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
             assert_eq!(iter.next().unwrap(), (i, i));
@@ -101,7 +103,9 @@ fn test_iter_rev() {
     // Forwards
     let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
-    fn test<T>(size: usize, mut iter: T) where T: Iterator<Item=(usize, usize)> {
+    fn test<T>(size: usize, mut iter: T)
+        where T: Iterator<Item = (usize, usize)>
+    {
         for i in 0..size {
             assert_eq!(iter.size_hint(), (size - i, Some(size - i)));
             assert_eq!(iter.next().unwrap(), (size - i - 1, size - i - 1));
@@ -125,8 +129,7 @@ fn test_values_mut() {
     }
 
     let values: Vec<String> = a.values().cloned().collect();
-    assert_eq!(values, [String::from("hello!"),
-                        String::from("goodbye!")]);
+    assert_eq!(values, [String::from("hello!"), String::from("goodbye!")]);
 }
 
 #[test]
@@ -137,7 +140,8 @@ fn test_iter_mixed() {
     let mut map: BTreeMap<_, _> = (0..size).map(|i| (i, i)).collect();
 
     fn test<T>(size: usize, mut iter: T)
-            where T: Iterator<Item=(usize, usize)> + DoubleEndedIterator {
+        where T: Iterator<Item = (usize, usize)> + DoubleEndedIterator
+    {
         for i in 0..size / 4 {
             assert_eq!(iter.size_hint(), (size - i * 2, Some(size - i * 2)));
             assert_eq!(iter.next().unwrap(), (i, i));
@@ -202,7 +206,7 @@ fn test_range() {
     for i in 0..size {
         for j in i..size {
             let mut kvs = map.range(Included(&i), Included(&j)).map(|(&k, &v)| (k, v));
-            let mut pairs = (i..j+1).map(|i| (i, i));
+            let mut pairs = (i..j + 1).map(|i| (i, i));
 
             for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) {
                 assert_eq!(kv, pair);
@@ -242,7 +246,7 @@ fn test_borrow() {
 }
 
 #[test]
-fn test_entry(){
+fn test_entry() {
     let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)];
 
     let mut map: BTreeMap<_, _> = xs.iter().cloned().collect();
@@ -341,17 +345,23 @@ fn test_bad_zst() {
     struct Bad;
 
     impl PartialEq for Bad {
-        fn eq(&self, _: &Self) -> bool { false }
+        fn eq(&self, _: &Self) -> bool {
+            false
+        }
     }
 
     impl Eq for Bad {}
 
     impl PartialOrd for Bad {
-        fn partial_cmp(&self, _: &Self) -> Option<Ordering> { Some(Ordering::Less) }
+        fn partial_cmp(&self, _: &Self) -> Option<Ordering> {
+            Some(Ordering::Less)
+        }
     }
 
     impl Ord for Bad {
-        fn cmp(&self, _: &Self) -> Ordering { Ordering::Less }
+        fn cmp(&self, _: &Self) -> Ordering {
+            Ordering::Less
+        }
     }
 
     let mut m = BTreeMap::new();
@@ -368,27 +378,27 @@ fn test_clone() {
     assert_eq!(map.len(), 0);
 
     for i in 0..size {
-        assert_eq!(map.insert(i, 10*i), None);
+        assert_eq!(map.insert(i, 10 * i), None);
         assert_eq!(map.len(), i + 1);
         assert_eq!(map, map.clone());
     }
 
     for i in 0..size {
-        assert_eq!(map.insert(i, 100*i), Some(10*i));
+        assert_eq!(map.insert(i, 100 * i), Some(10 * i));
         assert_eq!(map.len(), size);
         assert_eq!(map, map.clone());
     }
 
-    for i in 0..size/2 {
-        assert_eq!(map.remove(&(i*2)), Some(i*200));
+    for i in 0..size / 2 {
+        assert_eq!(map.remove(&(i * 2)), Some(i * 200));
         assert_eq!(map.len(), size - i - 1);
         assert_eq!(map, map.clone());
     }
 
-    for i in 0..size/2 {
-        assert_eq!(map.remove(&(2*i)), None);
-        assert_eq!(map.remove(&(2*i+1)), Some(i*200 + 100));
-        assert_eq!(map.len(), size/2 - i - 1);
+    for i in 0..size / 2 {
+        assert_eq!(map.remove(&(2 * i)), None);
+        assert_eq!(map.remove(&(2 * i + 1)), Some(i * 200 + 100));
+        assert_eq!(map.len(), size / 2 - i - 1);
         assert_eq!(map, map.clone());
     }
 }
@@ -398,16 +408,36 @@ fn test_clone() {
 fn test_variance() {
     use std::collections::btree_map::{Iter, IntoIter, Range, Keys, Values};
 
-    fn map_key<'new>(v: BTreeMap<&'static str, ()>) -> BTreeMap<&'new str, ()> { v }
-    fn map_val<'new>(v: BTreeMap<(), &'static str>) -> BTreeMap<(), &'new str> { v }
-    fn iter_key<'a, 'new>(v: Iter<'a, &'static str, ()>) -> Iter<'a, &'new str, ()> { v }
-    fn iter_val<'a, 'new>(v: Iter<'a, (), &'static str>) -> Iter<'a, (), &'new str> { v }
-    fn into_iter_key<'new>(v: IntoIter<&'static str, ()>) -> IntoIter<&'new str, ()> { v }
-    fn into_iter_val<'new>(v: IntoIter<(), &'static str>) -> IntoIter<(), &'new str> { v }
-    fn range_key<'a, 'new>(v: Range<'a, &'static str, ()>) -> Range<'a, &'new str, ()> { v }
-    fn range_val<'a, 'new>(v: Range<'a, (), &'static str>) -> Range<'a, (), &'new str> { v }
-    fn keys<'a, 'new>(v: Keys<'a, &'static str, ()>) -> Keys<'a, &'new str, ()> { v }
-    fn vals<'a, 'new>(v: Values<'a, (), &'static str>) -> Values<'a, (), &'new str> { v }
+    fn map_key<'new>(v: BTreeMap<&'static str, ()>) -> BTreeMap<&'new str, ()> {
+        v
+    }
+    fn map_val<'new>(v: BTreeMap<(), &'static str>) -> BTreeMap<(), &'new str> {
+        v
+    }
+    fn iter_key<'a, 'new>(v: Iter<'a, &'static str, ()>) -> Iter<'a, &'new str, ()> {
+        v
+    }
+    fn iter_val<'a, 'new>(v: Iter<'a, (), &'static str>) -> Iter<'a, (), &'new str> {
+        v
+    }
+    fn into_iter_key<'new>(v: IntoIter<&'static str, ()>) -> IntoIter<&'new str, ()> {
+        v
+    }
+    fn into_iter_val<'new>(v: IntoIter<(), &'static str>) -> IntoIter<(), &'new str> {
+        v
+    }
+    fn range_key<'a, 'new>(v: Range<'a, &'static str, ()>) -> Range<'a, &'new str, ()> {
+        v
+    }
+    fn range_val<'a, 'new>(v: Range<'a, (), &'static str>) -> Range<'a, (), &'new str> {
+        v
+    }
+    fn keys<'a, 'new>(v: Keys<'a, &'static str, ()>) -> Keys<'a, &'new str, ()> {
+        v
+    }
+    fn vals<'a, 'new>(v: Values<'a, (), &'static str>) -> Values<'a, (), &'new str> {
+        v
+    }
 }
 
 #[test]
@@ -440,7 +470,7 @@ fn test_vacant_entry_key() {
         Vacant(e) => {
             assert_eq!(key, *e.key());
             e.insert(value.clone());
-        },
+        }
     }
     assert_eq!(a.len(), 1);
     assert_eq!(a[key], value);
diff --git a/src/libcollectionstest/enum_set.rs b/src/libcollectionstest/enum_set.rs
index b073c2f3ae4..0702471104b 100644
--- a/src/libcollectionstest/enum_set.rs
+++ b/src/libcollectionstest/enum_set.rs
@@ -17,7 +17,9 @@ use self::Foo::*;
 #[derive(Copy, Clone, PartialEq, Debug)]
 #[repr(usize)]
 enum Foo {
-    A, B, C
+    A,
+    B,
+    C,
 }
 
 impl CLike for Foo {
@@ -60,9 +62,8 @@ fn test_len() {
     assert_eq!(e.len(), 0);
 }
 
-///////////////////////////////////////////////////////////////////////////
-// intersect
-
+/// ////////////////////////////////////////////////////////////////////////
+/// intersect
 #[test]
 fn test_two_empties_do_not_intersect() {
     let e1: EnumSet<Foo> = EnumSet::new();
@@ -105,9 +106,8 @@ fn test_overlapping_intersects() {
     assert!(!e1.is_disjoint(&e2));
 }
 
-///////////////////////////////////////////////////////////////////////////
-// contains and contains_elem
-
+/// ////////////////////////////////////////////////////////////////////////
+/// contains and contains_elem
 #[test]
 fn test_superset() {
     let mut e1: EnumSet<Foo> = EnumSet::new();
@@ -141,9 +141,8 @@ fn test_contains() {
     assert!(!e1.contains(&C));
 }
 
-///////////////////////////////////////////////////////////////////////////
-// iter
-
+/// ////////////////////////////////////////////////////////////////////////
+/// iter
 #[test]
 fn test_iterator() {
     let mut e1: EnumSet<Foo> = EnumSet::new();
@@ -157,20 +156,19 @@ fn test_iterator() {
 
     e1.insert(C);
     let elems: Vec<_> = e1.iter().collect();
-    assert_eq!(elems, [A,C]);
+    assert_eq!(elems, [A, C]);
 
     e1.insert(C);
     let elems: Vec<_> = e1.iter().collect();
-    assert_eq!(elems, [A,C]);
+    assert_eq!(elems, [A, C]);
 
     e1.insert(B);
     let elems: Vec<_> = e1.iter().collect();
-    assert_eq!(elems, [A,B,C]);
+    assert_eq!(elems, [A, B, C]);
 }
 
-///////////////////////////////////////////////////////////////////////////
-// operators
-
+/// ////////////////////////////////////////////////////////////////////////
+/// operators
 #[test]
 fn test_operators() {
     let mut e1: EnumSet<Foo> = EnumSet::new();
@@ -183,7 +181,7 @@ fn test_operators() {
 
     let e_union = e1 | e2;
     let elems: Vec<_> = e_union.iter().collect();
-    assert_eq!(elems, [A,B,C]);
+    assert_eq!(elems, [A, B, C]);
 
     let e_intersection = e1 & e2;
     let elems: Vec<_> = e_intersection.iter().collect();
@@ -201,17 +199,17 @@ fn test_operators() {
     // Bitwise XOR of two sets, aka symmetric difference
     let e_symmetric_diff = e1 ^ e2;
     let elems: Vec<_> = e_symmetric_diff.iter().collect();
-    assert_eq!(elems, [A,B]);
+    assert_eq!(elems, [A, B]);
 
     // Another way to express symmetric difference
     let e_symmetric_diff = (e1 - e2) | (e2 - e1);
     let elems: Vec<_> = e_symmetric_diff.iter().collect();
-    assert_eq!(elems, [A,B]);
+    assert_eq!(elems, [A, B]);
 
     // Yet another way to express symmetric difference
     let e_symmetric_diff = (e1 | e2) - (e1 & e2);
     let elems: Vec<_> = e_symmetric_diff.iter().collect();
-    assert_eq!(elems, [A,B]);
+    assert_eq!(elems, [A, B]);
 }
 
 #[test]
@@ -221,13 +219,76 @@ fn test_overflow() {
     #[derive(Copy, Clone)]
     #[repr(usize)]
     enum Bar {
-        V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
-        V10, V11, V12, V13, V14, V15, V16, V17, V18, V19,
-        V20, V21, V22, V23, V24, V25, V26, V27, V28, V29,
-        V30, V31, V32, V33, V34, V35, V36, V37, V38, V39,
-        V40, V41, V42, V43, V44, V45, V46, V47, V48, V49,
-        V50, V51, V52, V53, V54, V55, V56, V57, V58, V59,
-        V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
+        V00,
+        V01,
+        V02,
+        V03,
+        V04,
+        V05,
+        V06,
+        V07,
+        V08,
+        V09,
+        V10,
+        V11,
+        V12,
+        V13,
+        V14,
+        V15,
+        V16,
+        V17,
+        V18,
+        V19,
+        V20,
+        V21,
+        V22,
+        V23,
+        V24,
+        V25,
+        V26,
+        V27,
+        V28,
+        V29,
+        V30,
+        V31,
+        V32,
+        V33,
+        V34,
+        V35,
+        V36,
+        V37,
+        V38,
+        V39,
+        V40,
+        V41,
+        V42,
+        V43,
+        V44,
+        V45,
+        V46,
+        V47,
+        V48,
+        V49,
+        V50,
+        V51,
+        V52,
+        V53,
+        V54,
+        V55,
+        V56,
+        V57,
+        V58,
+        V59,
+        V60,
+        V61,
+        V62,
+        V63,
+        V64,
+        V65,
+        V66,
+        V67,
+        V68,
+        V69,
     }
 
     impl CLike for Bar {
diff --git a/src/libcollectionstest/linked_list.rs b/src/libcollectionstest/linked_list.rs
index 7265d53be48..956d75a95a5 100644
--- a/src/libcollectionstest/linked_list.rs
+++ b/src/libcollectionstest/linked_list.rs
@@ -54,7 +54,7 @@ fn test_basic() {
 
 #[cfg(test)]
 fn generate_test() -> LinkedList<i32> {
-    list_from(&[0,1,2,3,4,5,6])
+    list_from(&[0, 1, 2, 3, 4, 5, 6])
 }
 
 #[cfg(test)]
@@ -78,7 +78,7 @@ fn test_split_off() {
 
     // not singleton, forwards
     {
-        let u = vec![1,2,3,4,5];
+        let u = vec![1, 2, 3, 4, 5];
         let mut m = list_from(&u);
         let mut n = m.split_off(2);
         assert_eq!(m.len(), 2);
@@ -92,7 +92,7 @@ fn test_split_off() {
     }
     // not singleton, backwards
     {
-        let u = vec![1,2,3,4,5];
+        let u = vec![1, 2, 3, 4, 5];
         let mut m = list_from(&u);
         let mut n = m.split_off(4);
         assert_eq!(m.len(), 4);
@@ -246,33 +246,33 @@ fn test_eq() {
     m.push_back(1);
     assert!(n == m);
 
-    let n = list_from(&[2,3,4]);
-    let m = list_from(&[1,2,3]);
+    let n = list_from(&[2, 3, 4]);
+    let m = list_from(&[1, 2, 3]);
     assert!(n != m);
 }
 
 #[test]
 fn test_hash() {
-  let mut x = LinkedList::new();
-  let mut y = LinkedList::new();
+    let mut x = LinkedList::new();
+    let mut y = LinkedList::new();
 
-  assert!(::hash(&x) == ::hash(&y));
+    assert!(::hash(&x) == ::hash(&y));
 
-  x.push_back(1);
-  x.push_back(2);
-  x.push_back(3);
+    x.push_back(1);
+    x.push_back(2);
+    x.push_back(3);
 
-  y.push_front(3);
-  y.push_front(2);
-  y.push_front(1);
+    y.push_front(3);
+    y.push_front(2);
+    y.push_front(1);
 
-  assert!(::hash(&x) == ::hash(&y));
+    assert!(::hash(&x) == ::hash(&y));
 }
 
 #[test]
 fn test_ord() {
     let n = list_from(&[]);
-    let m = list_from(&[1,2,3]);
+    let m = list_from(&[1, 2, 3]);
     assert!(n < m);
     assert!(m > n);
     assert!(n <= n);
@@ -281,7 +281,7 @@ fn test_ord() {
 
 #[test]
 fn test_ord_nan() {
-    let nan = 0.0f64/0.0;
+    let nan = 0.0f64 / 0.0;
     let n = list_from(&[nan]);
     let m = list_from(&[nan]);
     assert!(!(n < m));
@@ -296,15 +296,15 @@ fn test_ord_nan() {
     assert!(!(n <= one));
     assert!(!(n >= one));
 
-    let u = list_from(&[1.0f64,2.0,nan]);
-    let v = list_from(&[1.0f64,2.0,3.0]);
+    let u = list_from(&[1.0f64, 2.0, nan]);
+    let v = list_from(&[1.0f64, 2.0, 3.0]);
     assert!(!(u < v));
     assert!(!(u > v));
     assert!(!(u <= v));
     assert!(!(u >= v));
 
-    let s = list_from(&[1.0f64,2.0,4.0,2.0]);
-    let t = list_from(&[1.0f64,2.0,3.0,2.0]);
+    let s = list_from(&[1.0f64, 2.0, 4.0, 2.0]);
+    let t = list_from(&[1.0f64, 2.0, 3.0, 2.0]);
     assert!(!(s < t));
     assert!(s > one);
     assert!(!(s <= one));
@@ -317,7 +317,8 @@ fn test_show() {
     assert_eq!(format!("{:?}", list), "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
 
     let list: LinkedList<_> = vec!["just", "one", "test", "more"].iter().cloned().collect();
-    assert_eq!(format!("{:?}", list), "[\"just\", \"one\", \"test\", \"more\"]");
+    assert_eq!(format!("{:?}", list),
+               "[\"just\", \"one\", \"test\", \"more\"]");
 }
 
 #[test]
diff --git a/src/libcollectionstest/slice.rs b/src/libcollectionstest/slice.rs
index 236c151891d..76d70b113f7 100644
--- a/src/libcollectionstest/slice.rs
+++ b/src/libcollectionstest/slice.rs
@@ -13,9 +13,13 @@ use std::mem;
 use std::__rand::{Rng, thread_rng};
 use std::rc::Rc;
 
-fn square(n: usize) -> usize { n * n }
+fn square(n: usize) -> usize {
+    n * n
+}
 
-fn is_odd(n: &usize) -> bool { *n % 2 == 1 }
+fn is_odd(n: &usize) -> bool {
+    *n % 2 == 1
+}
 
 #[test]
 fn test_from_fn() {
@@ -76,9 +80,9 @@ fn test_is_empty() {
 #[test]
 fn test_len_divzero() {
     type Z = [i8; 0];
-    let v0 : &[Z] = &[];
-    let v1 : &[Z] = &[[]];
-    let v2 : &[Z] = &[[], []];
+    let v0: &[Z] = &[];
+    let v1: &[Z] = &[[]];
+    let v2: &[Z] = &[[], []];
     assert_eq!(mem::size_of::<Z>(), 0);
     assert_eq!(v0.len(), 0);
     assert_eq!(v1.len(), 1);
@@ -295,7 +299,7 @@ fn test_push() {
 
 #[test]
 fn test_truncate() {
-    let mut v: Vec<Box<_>> = vec![box 6,box 5,box 4];
+    let mut v: Vec<Box<_>> = vec![box 6, box 5, box 4];
     v.truncate(1);
     let v = v;
     assert_eq!(v.len(), 1);
@@ -305,7 +309,7 @@ fn test_truncate() {
 
 #[test]
 fn test_clear() {
-    let mut v: Vec<Box<_>> = vec![box 6,box 5,box 4];
+    let mut v: Vec<Box<_>> = vec![box 6, box 5, box 4];
     v.clear();
     assert_eq!(v.len(), 0);
     // If the unsafe block didn't drop things properly, we blow up here.
@@ -320,12 +324,12 @@ fn test_dedup() {
     }
     case(vec![], vec![]);
     case(vec![1], vec![1]);
-    case(vec![1,1], vec![1]);
-    case(vec![1,2,3], vec![1,2,3]);
-    case(vec![1,1,2,3], vec![1,2,3]);
-    case(vec![1,2,2,3], vec![1,2,3]);
-    case(vec![1,2,3,3], vec![1,2,3]);
-    case(vec![1,1,2,2,2,3,3], vec![1,2,3]);
+    case(vec![1, 1], vec![1]);
+    case(vec![1, 2, 3], vec![1, 2, 3]);
+    case(vec![1, 1, 2, 3], vec![1, 2, 3]);
+    case(vec![1, 2, 2, 3], vec![1, 2, 3]);
+    case(vec![1, 2, 3, 3], vec![1, 2, 3]);
+    case(vec![1, 1, 2, 2, 2, 3, 3], vec![1, 2, 3]);
 }
 
 #[test]
@@ -336,10 +340,9 @@ fn test_dedup_unique() {
     v1.dedup();
     let mut v2: Vec<Box<_>> = vec![box 1, box 2, box 3, box 3];
     v2.dedup();
-    /*
-     * If the boxed pointers were leaked or otherwise misused, valgrind
-     * and/or rt should raise errors.
-     */
+    // If the boxed pointers were leaked or otherwise misused, valgrind
+    // and/or rt should raise errors.
+    //
 }
 
 #[test]
@@ -350,10 +353,9 @@ fn test_dedup_shared() {
     v1.dedup();
     let mut v2: Vec<Box<_>> = vec![box 1, box 2, box 3, box 3];
     v2.dedup();
-    /*
-     * If the pointers were leaked or otherwise misused, valgrind and/or
-     * rt should raise errors.
-     */
+    // If the pointers were leaked or otherwise misused, valgrind and/or
+    // rt should raise errors.
+    //
 }
 
 #[test]
@@ -365,31 +367,31 @@ fn test_retain() {
 
 #[test]
 fn test_binary_search() {
-    assert_eq!([1,2,3,4,5].binary_search(&5).ok(), Some(4));
-    assert_eq!([1,2,3,4,5].binary_search(&4).ok(), Some(3));
-    assert_eq!([1,2,3,4,5].binary_search(&3).ok(), Some(2));
-    assert_eq!([1,2,3,4,5].binary_search(&2).ok(), Some(1));
-    assert_eq!([1,2,3,4,5].binary_search(&1).ok(), Some(0));
-
-    assert_eq!([2,4,6,8,10].binary_search(&1).ok(), None);
-    assert_eq!([2,4,6,8,10].binary_search(&5).ok(), None);
-    assert_eq!([2,4,6,8,10].binary_search(&4).ok(), Some(1));
-    assert_eq!([2,4,6,8,10].binary_search(&10).ok(), Some(4));
-
-    assert_eq!([2,4,6,8].binary_search(&1).ok(), None);
-    assert_eq!([2,4,6,8].binary_search(&5).ok(), None);
-    assert_eq!([2,4,6,8].binary_search(&4).ok(), Some(1));
-    assert_eq!([2,4,6,8].binary_search(&8).ok(), Some(3));
-
-    assert_eq!([2,4,6].binary_search(&1).ok(), None);
-    assert_eq!([2,4,6].binary_search(&5).ok(), None);
-    assert_eq!([2,4,6].binary_search(&4).ok(), Some(1));
-    assert_eq!([2,4,6].binary_search(&6).ok(), Some(2));
-
-    assert_eq!([2,4].binary_search(&1).ok(), None);
-    assert_eq!([2,4].binary_search(&5).ok(), None);
-    assert_eq!([2,4].binary_search(&2).ok(), Some(0));
-    assert_eq!([2,4].binary_search(&4).ok(), Some(1));
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&5).ok(), Some(4));
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&4).ok(), Some(3));
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&3).ok(), Some(2));
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&2).ok(), Some(1));
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&1).ok(), Some(0));
+
+    assert_eq!([2, 4, 6, 8, 10].binary_search(&1).ok(), None);
+    assert_eq!([2, 4, 6, 8, 10].binary_search(&5).ok(), None);
+    assert_eq!([2, 4, 6, 8, 10].binary_search(&4).ok(), Some(1));
+    assert_eq!([2, 4, 6, 8, 10].binary_search(&10).ok(), Some(4));
+
+    assert_eq!([2, 4, 6, 8].binary_search(&1).ok(), None);
+    assert_eq!([2, 4, 6, 8].binary_search(&5).ok(), None);
+    assert_eq!([2, 4, 6, 8].binary_search(&4).ok(), Some(1));
+    assert_eq!([2, 4, 6, 8].binary_search(&8).ok(), Some(3));
+
+    assert_eq!([2, 4, 6].binary_search(&1).ok(), None);
+    assert_eq!([2, 4, 6].binary_search(&5).ok(), None);
+    assert_eq!([2, 4, 6].binary_search(&4).ok(), Some(1));
+    assert_eq!([2, 4, 6].binary_search(&6).ok(), Some(2));
+
+    assert_eq!([2, 4].binary_search(&1).ok(), None);
+    assert_eq!([2, 4].binary_search(&5).ok(), None);
+    assert_eq!([2, 4].binary_search(&2).ok(), Some(0));
+    assert_eq!([2, 4].binary_search(&4).ok(), Some(1));
 
     assert_eq!([2].binary_search(&1).ok(), None);
     assert_eq!([2].binary_search(&5).ok(), None);
@@ -398,14 +400,14 @@ fn test_binary_search() {
     assert_eq!([].binary_search(&1).ok(), None);
     assert_eq!([].binary_search(&5).ok(), None);
 
-    assert!([1,1,1,1,1].binary_search(&1).ok() != None);
-    assert!([1,1,1,1,2].binary_search(&1).ok() != None);
-    assert!([1,1,1,2,2].binary_search(&1).ok() != None);
-    assert!([1,1,2,2,2].binary_search(&1).ok() != None);
-    assert_eq!([1,2,2,2,2].binary_search(&1).ok(), Some(0));
+    assert!([1, 1, 1, 1, 1].binary_search(&1).ok() != None);
+    assert!([1, 1, 1, 1, 2].binary_search(&1).ok() != None);
+    assert!([1, 1, 1, 2, 2].binary_search(&1).ok() != None);
+    assert!([1, 1, 2, 2, 2].binary_search(&1).ok() != None);
+    assert_eq!([1, 2, 2, 2, 2].binary_search(&1).ok(), Some(0));
 
-    assert_eq!([1,2,3,4,5].binary_search(&6).ok(), None);
-    assert_eq!([1,2,3,4,5].binary_search(&0).ok(), None);
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&6).ok(), None);
+    assert_eq!([1, 2, 3, 4, 5].binary_search(&0).ok(), None);
 }
 
 #[test]
@@ -460,15 +462,17 @@ fn test_sort_stability() {
             // the second item represents which occurrence of that
             // number this element is, i.e. the second elements
             // will occur in sorted order.
-            let mut v: Vec<_> = (0..len).map(|_| {
-                    let n = thread_rng().gen::<usize>() % 10;
-                    counts[n] += 1;
-                    (n, counts[n])
-                }).collect();
+            let mut v: Vec<_> = (0..len)
+                                    .map(|_| {
+                                        let n = thread_rng().gen::<usize>() % 10;
+                                        counts[n] += 1;
+                                        (n, counts[n])
+                                    })
+                                    .collect();
 
             // only sort on the first element, so an unstable sort
             // may mix up the counts.
-            v.sort_by(|&(a,_), &(b,_)| a.cmp(&b));
+            v.sort_by(|&(a, _), &(b, _)| a.cmp(&b));
 
             // this comparison includes the count (the second item
             // of the tuple), so elements with equal first items
@@ -679,7 +683,7 @@ fn test_rev_iterator() {
 #[test]
 fn test_mut_rev_iterator() {
     let mut xs = [1, 2, 3, 4, 5];
-    for (i,x) in xs.iter_mut().rev().enumerate() {
+    for (i, x) in xs.iter_mut().rev().enumerate() {
         *x += i;
     }
     assert!(xs == [5, 5, 5, 5, 5])
@@ -687,35 +691,32 @@ fn test_mut_rev_iterator() {
 
 #[test]
 fn test_move_iterator() {
-    let xs = vec![1,2,3,4,5];
-    assert_eq!(xs.into_iter().fold(0, |a: usize, b: usize| 10*a + b), 12345);
+    let xs = vec![1, 2, 3, 4, 5];
+    assert_eq!(xs.into_iter().fold(0, |a: usize, b: usize| 10 * a + b),
+               12345);
 }
 
 #[test]
 fn test_move_rev_iterator() {
-    let xs = vec![1,2,3,4,5];
-    assert_eq!(xs.into_iter().rev().fold(0, |a: usize, b: usize| 10*a + b), 54321);
+    let xs = vec![1, 2, 3, 4, 5];
+    assert_eq!(xs.into_iter().rev().fold(0, |a: usize, b: usize| 10 * a + b),
+               54321);
 }
 
 #[test]
 fn test_splitator() {
-    let xs = &[1,2,3,4,5];
+    let xs = &[1, 2, 3, 4, 5];
 
     let splits: &[&[_]] = &[&[1], &[3], &[5]];
-    assert_eq!(xs.split(|x| *x % 2 == 0).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[], &[2,3,4,5]];
-    assert_eq!(xs.split(|x| *x == 1).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[1,2,3,4], &[]];
-    assert_eq!(xs.split(|x| *x == 5).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[1,2,3,4,5]];
-    assert_eq!(xs.split(|x| *x == 10).collect::<Vec<_>>(),
-               splits);
+    assert_eq!(xs.split(|x| *x % 2 == 0).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[], &[2, 3, 4, 5]];
+    assert_eq!(xs.split(|x| *x == 1).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[1, 2, 3, 4], &[]];
+    assert_eq!(xs.split(|x| *x == 5).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
+    assert_eq!(xs.split(|x| *x == 10).collect::<Vec<_>>(), splits);
     let splits: &[&[_]] = &[&[], &[], &[], &[], &[], &[]];
-    assert_eq!(xs.split(|_| true).collect::<Vec<&[i32]>>(),
-               splits);
+    assert_eq!(xs.split(|_| true).collect::<Vec<&[i32]>>(), splits);
 
     let xs: &[i32] = &[];
     let splits: &[&[i32]] = &[&[]];
@@ -724,17 +725,14 @@ fn test_splitator() {
 
 #[test]
 fn test_splitnator() {
-    let xs = &[1,2,3,4,5];
+    let xs = &[1, 2, 3, 4, 5];
 
-    let splits: &[&[_]] = &[&[1,2,3,4,5]];
-    assert_eq!(xs.splitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[1], &[3,4,5]];
-    assert_eq!(xs.splitn(2, |x| *x % 2 == 0).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[], &[], &[], &[4,5]];
-    assert_eq!(xs.splitn(4, |_| true).collect::<Vec<_>>(),
-               splits);
+    let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
+    assert_eq!(xs.splitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[1], &[3, 4, 5]];
+    assert_eq!(xs.splitn(2, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[], &[], &[], &[4, 5]];
+    assert_eq!(xs.splitn(4, |_| true).collect::<Vec<_>>(), splits);
 
     let xs: &[i32] = &[];
     let splits: &[&[i32]] = &[&[]];
@@ -743,40 +741,34 @@ fn test_splitnator() {
 
 #[test]
 fn test_splitnator_mut() {
-    let xs = &mut [1,2,3,4,5];
+    let xs = &mut [1, 2, 3, 4, 5];
 
-    let splits: &[&mut[_]] = &[&mut [1,2,3,4,5]];
+    let splits: &[&mut [_]] = &[&mut [1, 2, 3, 4, 5]];
     assert_eq!(xs.splitn_mut(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
                splits);
-    let splits: &[&mut[_]] = &[&mut [1], &mut [3,4,5]];
+    let splits: &[&mut [_]] = &[&mut [1], &mut [3, 4, 5]];
     assert_eq!(xs.splitn_mut(2, |x| *x % 2 == 0).collect::<Vec<_>>(),
                splits);
-    let splits: &[&mut[_]] = &[&mut [], &mut [], &mut [], &mut [4,5]];
-    assert_eq!(xs.splitn_mut(4, |_| true).collect::<Vec<_>>(),
-               splits);
+    let splits: &[&mut [_]] = &[&mut [], &mut [], &mut [], &mut [4, 5]];
+    assert_eq!(xs.splitn_mut(4, |_| true).collect::<Vec<_>>(), splits);
 
     let xs: &mut [i32] = &mut [];
-    let splits: &[&mut[i32]] = &[&mut []];
-    assert_eq!(xs.splitn_mut(2, |x| *x == 5).collect::<Vec<_>>(),
-               splits);
+    let splits: &[&mut [i32]] = &[&mut []];
+    assert_eq!(xs.splitn_mut(2, |x| *x == 5).collect::<Vec<_>>(), splits);
 }
 
 #[test]
 fn test_rsplitator() {
-    let xs = &[1,2,3,4,5];
+    let xs = &[1, 2, 3, 4, 5];
 
     let splits: &[&[_]] = &[&[5], &[3], &[1]];
-    assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[2,3,4,5], &[]];
-    assert_eq!(xs.split(|x| *x == 1).rev().collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[], &[1,2,3,4]];
-    assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[1,2,3,4,5]];
-    assert_eq!(xs.split(|x| *x == 10).rev().collect::<Vec<_>>(),
-               splits);
+    assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[2, 3, 4, 5], &[]];
+    assert_eq!(xs.split(|x| *x == 1).rev().collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[], &[1, 2, 3, 4]];
+    assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
+    assert_eq!(xs.split(|x| *x == 10).rev().collect::<Vec<_>>(), splits);
 
     let xs: &[i32] = &[];
     let splits: &[&[i32]] = &[&[]];
@@ -785,19 +777,16 @@ fn test_rsplitator() {
 
 #[test]
 fn test_rsplitnator() {
-    let xs = &[1,2,3,4,5];
+    let xs = &[1, 2, 3, 4, 5];
 
-    let splits: &[&[_]] = &[&[1,2,3,4,5]];
-    assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[5], &[1,2,3]];
-    assert_eq!(xs.rsplitn(2, |x| *x % 2 == 0).collect::<Vec<_>>(),
-               splits);
-    let splits: &[&[_]] = &[&[], &[], &[], &[1,2]];
-    assert_eq!(xs.rsplitn(4, |_| true).collect::<Vec<_>>(),
-               splits);
+    let splits: &[&[_]] = &[&[1, 2, 3, 4, 5]];
+    assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[5], &[1, 2, 3]];
+    assert_eq!(xs.rsplitn(2, |x| *x % 2 == 0).collect::<Vec<_>>(), splits);
+    let splits: &[&[_]] = &[&[], &[], &[], &[1, 2]];
+    assert_eq!(xs.rsplitn(4, |_| true).collect::<Vec<_>>(), splits);
 
-    let xs: &[i32]  = &[];
+    let xs: &[i32] = &[];
     let splits: &[&[i32]] = &[&[]];
     assert_eq!(xs.rsplitn(2, |x| *x == 5).collect::<Vec<&[i32]>>(), splits);
     assert!(xs.rsplitn(0, |x| *x % 2 == 0).next().is_none());
@@ -805,55 +794,55 @@ fn test_rsplitnator() {
 
 #[test]
 fn test_windowsator() {
-    let v = &[1,2,3,4];
+    let v = &[1, 2, 3, 4];
 
-    let wins: &[&[_]] = &[&[1,2], &[2,3], &[3,4]];
+    let wins: &[&[_]] = &[&[1, 2], &[2, 3], &[3, 4]];
     assert_eq!(v.windows(2).collect::<Vec<_>>(), wins);
 
-    let wins: &[&[_]] = &[&[1,2,3], &[2,3,4]];
+    let wins: &[&[_]] = &[&[1, 2, 3], &[2, 3, 4]];
     assert_eq!(v.windows(3).collect::<Vec<_>>(), wins);
     assert!(v.windows(6).next().is_none());
 
-    let wins: &[&[_]] = &[&[3,4], &[2,3], &[1,2]];
+    let wins: &[&[_]] = &[&[3, 4], &[2, 3], &[1, 2]];
     assert_eq!(v.windows(2).rev().collect::<Vec<&[_]>>(), wins);
 }
 
 #[test]
 #[should_panic]
 fn test_windowsator_0() {
-    let v = &[1,2,3,4];
+    let v = &[1, 2, 3, 4];
     let _it = v.windows(0);
 }
 
 #[test]
 fn test_chunksator() {
-    let v = &[1,2,3,4,5];
+    let v = &[1, 2, 3, 4, 5];
 
     assert_eq!(v.chunks(2).len(), 3);
 
-    let chunks: &[&[_]] = &[&[1,2], &[3,4], &[5]];
+    let chunks: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
     assert_eq!(v.chunks(2).collect::<Vec<_>>(), chunks);
-    let chunks: &[&[_]] = &[&[1,2,3], &[4,5]];
+    let chunks: &[&[_]] = &[&[1, 2, 3], &[4, 5]];
     assert_eq!(v.chunks(3).collect::<Vec<_>>(), chunks);
-    let chunks: &[&[_]] = &[&[1,2,3,4,5]];
+    let chunks: &[&[_]] = &[&[1, 2, 3, 4, 5]];
     assert_eq!(v.chunks(6).collect::<Vec<_>>(), chunks);
 
-    let chunks: &[&[_]] = &[&[5], &[3,4], &[1,2]];
+    let chunks: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
     assert_eq!(v.chunks(2).rev().collect::<Vec<_>>(), chunks);
 }
 
 #[test]
 #[should_panic]
 fn test_chunksator_0() {
-    let v = &[1,2,3,4];
+    let v = &[1, 2, 3, 4];
     let _it = v.chunks(0);
 }
 
 #[test]
 fn test_reverse_part() {
-    let mut values = [1,2,3,4,5];
+    let mut values = [1, 2, 3, 4, 5];
     values[1..4].reverse();
-    assert!(values == [1,4,3,2,5]);
+    assert!(values == [1, 4, 3, 2, 5]);
 }
 
 #[test]
@@ -869,16 +858,15 @@ fn test_show() {
     test_show_vec!(empty, "[]");
     test_show_vec!(vec![1], "[1]");
     test_show_vec!(vec![1, 2, 3], "[1, 2, 3]");
-    test_show_vec!(vec![vec![], vec![1], vec![1, 1]],
-                   "[[], [1], [1, 1]]");
+    test_show_vec!(vec![vec![], vec![1], vec![1, 1]], "[[], [1], [1, 1]]");
 
-    let empty_mut: &mut [i32] = &mut[];
+    let empty_mut: &mut [i32] = &mut [];
     test_show_vec!(empty_mut, "[]");
-    let v = &mut[1];
+    let v = &mut [1];
     test_show_vec!(v, "[1]");
-    let v = &mut[1, 2, 3];
+    let v = &mut [1, 2, 3];
     test_show_vec!(v, "[1, 2, 3]");
-    let v: &mut[&mut[_]] = &mut[&mut[], &mut[1], &mut[1, 1]];
+    let v: &mut [&mut [_]] = &mut [&mut [], &mut [1], &mut [1, 1]];
     test_show_vec!(v, "[[], [1], [1, 1]]");
 }
 
@@ -914,7 +902,7 @@ fn test_overflow_does_not_cause_segfault_managed() {
 
 #[test]
 fn test_mut_split_at() {
-    let mut values = [1,2,3,4,5];
+    let mut values = [1, 2, 3, 4, 5];
     {
         let (left, right) = values.split_at_mut(2);
         {
@@ -1021,32 +1009,32 @@ fn test_ends_with() {
 
 #[test]
 fn test_mut_splitator() {
-    let mut xs = [0,1,0,2,3,0,0,4,5,0];
+    let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0];
     assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
     for slice in xs.split_mut(|x| *x == 0) {
         slice.reverse();
     }
-    assert!(xs == [0,1,0,3,2,0,0,5,4,0]);
+    assert!(xs == [0, 1, 0, 3, 2, 0, 0, 5, 4, 0]);
 
-    let mut xs = [0,1,0,2,3,0,0,4,5,0,6,7];
+    let mut xs = [0, 1, 0, 2, 3, 0, 0, 4, 5, 0, 6, 7];
     for slice in xs.split_mut(|x| *x == 0).take(5) {
         slice.reverse();
     }
-    assert!(xs == [0,1,0,3,2,0,0,5,4,0,6,7]);
+    assert!(xs == [0, 1, 0, 3, 2, 0, 0, 5, 4, 0, 6, 7]);
 }
 
 #[test]
 fn test_mut_splitator_rev() {
-    let mut xs = [1,2,0,3,4,0,0,5,6,0];
+    let mut xs = [1, 2, 0, 3, 4, 0, 0, 5, 6, 0];
     for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
         slice.reverse();
     }
-    assert!(xs == [1,2,0,4,3,0,0,6,5,0]);
+    assert!(xs == [1, 2, 0, 4, 3, 0, 0, 6, 5, 0]);
 }
 
 #[test]
 fn test_get_mut() {
-    let mut v = [0,1,2];
+    let mut v = [0, 1, 2];
     assert_eq!(v.get_mut(3), None);
     v.get_mut(1).map(|e| *e = 7);
     assert_eq!(v[1], 7);
@@ -1119,7 +1107,7 @@ fn test_box_slice_clone_panics() {
 
     struct Canary {
         count: Arc<AtomicUsize>,
-        panics: bool
+        panics: bool,
     }
 
     impl Drop for Canary {
@@ -1130,27 +1118,37 @@ fn test_box_slice_clone_panics() {
 
     impl Clone for Canary {
         fn clone(&self) -> Self {
-            if self.panics { panic!() }
+            if self.panics {
+                panic!()
+            }
 
             Canary {
                 count: self.count.clone(),
-                panics: self.panics
+                panics: self.panics,
             }
         }
     }
 
     let drop_count = Arc::new(AtomicUsize::new(0));
-    let canary = Canary { count: drop_count.clone(), panics: false };
-    let panic = Canary { count: drop_count.clone(), panics: true };
+    let canary = Canary {
+        count: drop_count.clone(),
+        panics: false,
+    };
+    let panic = Canary {
+        count: drop_count.clone(),
+        panics: true,
+    };
 
     spawn(move || {
         // When xs is dropped, +5.
-        let xs = vec![canary.clone(), canary.clone(), canary.clone(),
-                      panic, canary].into_boxed_slice();
+        let xs = vec![canary.clone(), canary.clone(), canary.clone(), panic, canary]
+                     .into_boxed_slice();
 
         // When panic is cloned, +3.
         xs.clone();
-    }).join().unwrap_err();
+    })
+        .join()
+        .unwrap_err();
 
     // Total = 8
     assert_eq!(drop_count.load(Ordering::SeqCst), 8);
@@ -1198,7 +1196,9 @@ mod bench {
                 sum += *x;
             }
             // sum == 11806, to stop dead code elimination.
-            if sum == 0 {panic!()}
+            if sum == 0 {
+                panic!()
+            }
         })
     }
 
@@ -1217,8 +1217,7 @@ mod bench {
 
     #[bench]
     fn concat(b: &mut Bencher) {
-        let xss: Vec<Vec<i32>> =
-            (0..100).map(|i| (0..i).collect()).collect();
+        let xss: Vec<Vec<i32>> = (0..100).map(|i| (0..i).collect()).collect();
         b.iter(|| {
             xss.concat();
         });
@@ -1226,11 +1225,8 @@ mod bench {
 
     #[bench]
     fn join(b: &mut Bencher) {
-        let xss: Vec<Vec<i32>> =
-            (0..100).map(|i| (0..i).collect()).collect();
-        b.iter(|| {
-            xss.join(&0)
-        });
+        let xss: Vec<Vec<i32>> = (0..100).map(|i| (0..i).collect()).collect();
+        b.iter(|| xss.join(&0));
     }
 
     #[bench]
@@ -1245,17 +1241,13 @@ mod bench {
     #[bench]
     fn starts_with_same_vector(b: &mut Bencher) {
         let vec: Vec<_> = (0..100).collect();
-        b.iter(|| {
-            vec.starts_with(&vec)
-        })
+        b.iter(|| vec.starts_with(&vec))
     }
 
     #[bench]
     fn starts_with_single_element(b: &mut Bencher) {
         let vec: Vec<_> = vec![0];
-        b.iter(|| {
-            vec.starts_with(&vec)
-        })
+        b.iter(|| vec.starts_with(&vec))
     }
 
     #[bench]
@@ -1263,25 +1255,19 @@ mod bench {
         let vec: Vec<_> = (0..100).collect();
         let mut match_vec: Vec<_> = (0..99).collect();
         match_vec.push(0);
-        b.iter(|| {
-            vec.starts_with(&match_vec)
-        })
+        b.iter(|| vec.starts_with(&match_vec))
     }
 
     #[bench]
     fn ends_with_same_vector(b: &mut Bencher) {
         let vec: Vec<_> = (0..100).collect();
-        b.iter(|| {
-            vec.ends_with(&vec)
-        })
+        b.iter(|| vec.ends_with(&vec))
     }
 
     #[bench]
     fn ends_with_single_element(b: &mut Bencher) {
         let vec: Vec<_> = vec![0];
-        b.iter(|| {
-            vec.ends_with(&vec)
-        })
+        b.iter(|| vec.ends_with(&vec))
     }
 
     #[bench]
@@ -1289,24 +1275,18 @@ mod bench {
         let vec: Vec<_> = (0..100).collect();
         let mut match_vec: Vec<_> = (0..100).collect();
         match_vec[0] = 200;
-        b.iter(|| {
-            vec.starts_with(&match_vec)
-        })
+        b.iter(|| vec.starts_with(&match_vec))
     }
 
     #[bench]
     fn contains_last_element(b: &mut Bencher) {
         let vec: Vec<_> = (0..100).collect();
-        b.iter(|| {
-            vec.contains(&99)
-        })
+        b.iter(|| vec.contains(&99))
     }
 
     #[bench]
     fn zero_1kb_from_elem(b: &mut Bencher) {
-        b.iter(|| {
-            vec![0u8; 1024]
-        });
+        b.iter(|| vec![0u8; 1024]);
     }
 
     #[bench]
@@ -1356,8 +1336,7 @@ mod bench {
             let mut v = vec![(0, 0); 30];
             for _ in 0..100 {
                 let l = v.len();
-                v.insert(rng.gen::<usize>() % (l + 1),
-                         (1, 1));
+                v.insert(rng.gen::<usize>() % (l + 1), (1, 1));
             }
         })
     }
@@ -1418,7 +1397,8 @@ mod bench {
     fn sort_big_random_small(b: &mut Bencher) {
         let mut rng = thread_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<BigSortable>().take(5)
+            let mut v = rng.gen_iter::<BigSortable>()
+                           .take(5)
                            .collect::<Vec<BigSortable>>();
             v.sort();
         });
@@ -1429,7 +1409,8 @@ mod bench {
     fn sort_big_random_medium(b: &mut Bencher) {
         let mut rng = thread_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<BigSortable>().take(100)
+            let mut v = rng.gen_iter::<BigSortable>()
+                           .take(100)
                            .collect::<Vec<BigSortable>>();
             v.sort();
         });
@@ -1440,7 +1421,8 @@ mod bench {
     fn sort_big_random_large(b: &mut Bencher) {
         let mut rng = thread_rng();
         b.iter(|| {
-            let mut v = rng.gen_iter::<BigSortable>().take(10000)
+            let mut v = rng.gen_iter::<BigSortable>()
+                           .take(10000)
                            .collect::<Vec<BigSortable>>();
             v.sort();
         });
diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs
index c2eafa1b90f..7f0fd282ae5 100644
--- a/src/libcollectionstest/string.rs
+++ b/src/libcollectionstest/string.rs
@@ -31,8 +31,8 @@ impl<'a> IntoCow<'a, str> for &'a str {
 
 #[test]
 fn test_from_str() {
-  let owned: Option<::std::string::String> = "string".parse().ok();
-  assert_eq!(owned.as_ref().map(|s| &**s), Some("string"));
+    let owned: Option<::std::string::String> = "string".parse().ok();
+    assert_eq!(owned.as_ref().map(|s| &**s), Some("string"));
 }
 
 #[test]
@@ -44,8 +44,7 @@ fn test_unsized_to_string() {
 #[test]
 fn test_from_utf8() {
     let xs = b"hello".to_vec();
-    assert_eq!(String::from_utf8(xs).unwrap(),
-               String::from("hello"));
+    assert_eq!(String::from_utf8(xs).unwrap(), String::from("hello"));
 
     let xs = "ศไทย中华Việt Nam".as_bytes().to_vec();
     assert_eq!(String::from_utf8(xs).unwrap(),
@@ -87,56 +86,40 @@ fn test_from_utf8_lossy() {
                String::from("\u{FFFD}foo\u{FFFD}bar\u{FFFD}\u{FFFD}baz").into_cow());
 
     let xs = b"\xF0\x80\x80\x80foo\xF0\x90\x80\x80bar";
-    assert_eq!(String::from_utf8_lossy(xs), String::from("\u{FFFD}\u{FFFD}\u{FFFD}\u{FFFD}\
-                                           foo\u{10000}bar").into_cow());
+    assert_eq!(String::from_utf8_lossy(xs),
+               String::from("\u{FFFD}\u{FFFD}\u{FFFD}\u{FFFD}foo\u{10000}bar").into_cow());
 
     // surrogates
     let xs = b"\xED\xA0\x80foo\xED\xBF\xBFbar";
-    assert_eq!(String::from_utf8_lossy(xs), String::from("\u{FFFD}\u{FFFD}\u{FFFD}foo\
-                                           \u{FFFD}\u{FFFD}\u{FFFD}bar").into_cow());
+    assert_eq!(String::from_utf8_lossy(xs),
+               String::from("\u{FFFD}\u{FFFD}\u{FFFD}foo\u{FFFD}\u{FFFD}\u{FFFD}bar").into_cow());
 }
 
 #[test]
 fn test_from_utf16() {
-    let pairs =
-        [(String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
-          vec![0xd800, 0xdf45, 0xd800, 0xdf3f,
-            0xd800, 0xdf3b, 0xd800, 0xdf46,
-            0xd800, 0xdf39, 0xd800, 0xdf3b,
-            0xd800, 0xdf30, 0x000a]),
-
-         (String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
-          vec![0xd801, 0xdc12, 0xd801,
-            0xdc49, 0xd801, 0xdc2e, 0xd801,
-            0xdc40, 0xd801, 0xdc32, 0xd801,
-            0xdc4b, 0x0020, 0xd801, 0xdc0f,
-            0xd801, 0xdc32, 0xd801, 0xdc4d,
-            0x000a]),
-
-         (String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
-          vec![0xd800, 0xdf00, 0xd800, 0xdf16,
-            0xd800, 0xdf0b, 0xd800, 0xdf04,
-            0xd800, 0xdf11, 0xd800, 0xdf09,
-            0x00b7, 0xd800, 0xdf0c, 0xd800,
-            0xdf04, 0xd800, 0xdf15, 0xd800,
-            0xdf04, 0xd800, 0xdf0b, 0xd800,
-            0xdf09, 0xd800, 0xdf11, 0x000a ]),
-
-         (String::from("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
-          vec![0xd801, 0xdc8b, 0xd801, 0xdc98,
-            0xd801, 0xdc88, 0xd801, 0xdc91,
-            0xd801, 0xdc9b, 0xd801, 0xdc92,
-            0x0020, 0xd801, 0xdc95, 0xd801,
-            0xdc93, 0x0020, 0xd801, 0xdc88,
-            0xd801, 0xdc9a, 0xd801, 0xdc8d,
-            0x0020, 0xd801, 0xdc8f, 0xd801,
-            0xdc9c, 0xd801, 0xdc92, 0xd801,
-            0xdc96, 0xd801, 0xdc86, 0x0020,
-            0xd801, 0xdc95, 0xd801, 0xdc86,
-            0x000a ]),
-         // Issue #12318, even-numbered non-BMP planes
-         (String::from("\u{20000}"),
-          vec![0xD840, 0xDC00])];
+    let pairs = [(String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
+                  vec![0xd800, 0xdf45, 0xd800, 0xdf3f, 0xd800, 0xdf3b, 0xd800, 0xdf46, 0xd800,
+                       0xdf39, 0xd800, 0xdf3b, 0xd800, 0xdf30, 0x000a]),
+
+                 (String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
+                  vec![0xd801, 0xdc12, 0xd801, 0xdc49, 0xd801, 0xdc2e, 0xd801, 0xdc40, 0xd801,
+                       0xdc32, 0xd801, 0xdc4b, 0x0020, 0xd801, 0xdc0f, 0xd801, 0xdc32, 0xd801,
+                       0xdc4d, 0x000a]),
+
+                 (String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
+                  vec![0xd800, 0xdf00, 0xd800, 0xdf16, 0xd800, 0xdf0b, 0xd800, 0xdf04, 0xd800,
+                       0xdf11, 0xd800, 0xdf09, 0x00b7, 0xd800, 0xdf0c, 0xd800, 0xdf04, 0xd800,
+                       0xdf15, 0xd800, 0xdf04, 0xd800, 0xdf0b, 0xd800, 0xdf09, 0xd800, 0xdf11,
+                       0x000a]),
+
+                 (String::from("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
+                  vec![0xd801, 0xdc8b, 0xd801, 0xdc98, 0xd801, 0xdc88, 0xd801, 0xdc91, 0xd801,
+                       0xdc9b, 0xd801, 0xdc92, 0x0020, 0xd801, 0xdc95, 0xd801, 0xdc93, 0x0020,
+                       0xd801, 0xdc88, 0xd801, 0xdc9a, 0xd801, 0xdc8d, 0x0020, 0xd801, 0xdc8f,
+                       0xd801, 0xdc9c, 0xd801, 0xdc92, 0xd801, 0xdc96, 0xd801, 0xdc86, 0x0020,
+                       0xd801, 0xdc95, 0xd801, 0xdc86, 0x000a]),
+                 // Issue #12318, even-numbered non-BMP planes
+                 (String::from("\u{20000}"), vec![0xD840, 0xDC00])];
 
     for p in &pairs {
         let (s, u) = (*p).clone();
@@ -173,13 +156,15 @@ fn test_utf16_invalid() {
 fn test_from_utf16_lossy() {
     // completely positive cases tested above.
     // lead + eof
-    assert_eq!(String::from_utf16_lossy(&[0xD800]), String::from("\u{FFFD}"));
+    assert_eq!(String::from_utf16_lossy(&[0xD800]),
+               String::from("\u{FFFD}"));
     // lead + lead
     assert_eq!(String::from_utf16_lossy(&[0xD800, 0xD800]),
                String::from("\u{FFFD}\u{FFFD}"));
 
     // isolated trail
-    assert_eq!(String::from_utf16_lossy(&[0x0061, 0xDC00]), String::from("a\u{FFFD}"));
+    assert_eq!(String::from_utf16_lossy(&[0x0061, 0xDC00]),
+               String::from("a\u{FFFD}"));
 
     // general
     assert_eq!(String::from_utf16_lossy(&[0xD800, 0xd801, 0xdc8b, 0xD800]),
@@ -288,7 +273,8 @@ fn remove() {
     assert_eq!(s, "ไทย中华Vit Nam; foobar");
 }
 
-#[test] #[should_panic]
+#[test]
+#[should_panic]
 fn remove_bad() {
     "ศ".to_string().remove(1);
 }
@@ -302,8 +288,16 @@ fn insert() {
     assert_eq!(s, "ệfooยbar");
 }
 
-#[test] #[should_panic] fn insert_bad1() { "".to_string().insert(1, 't'); }
-#[test] #[should_panic] fn insert_bad2() { "ệ".to_string().insert(1, 't'); }
+#[test]
+#[should_panic]
+fn insert_bad1() {
+    "".to_string().insert(1, 't');
+}
+#[test]
+#[should_panic]
+fn insert_bad2() {
+    "ệ".to_string().insert(1, 't');
+}
 
 #[test]
 fn test_slicing() {
@@ -331,8 +325,7 @@ fn test_vectors() {
     assert_eq!(format!("{:?}", x), "[]");
     assert_eq!(format!("{:?}", vec![1]), "[1]");
     assert_eq!(format!("{:?}", vec![1, 2, 3]), "[1, 2, 3]");
-    assert!(format!("{:?}", vec![vec![], vec![1], vec![1, 1]]) ==
-           "[[], [1], [1, 1]]");
+    assert!(format!("{:?}", vec![vec![], vec![1], vec![1, 1]]) == "[[], [1], [1, 1]]");
 }
 
 #[test]
@@ -390,9 +383,7 @@ fn test_into_boxed_str() {
 
 #[bench]
 fn bench_with_capacity(b: &mut Bencher) {
-    b.iter(|| {
-        String::with_capacity(100)
-    });
+    b.iter(|| String::with_capacity(100));
 }
 
 #[bench]
@@ -495,25 +486,19 @@ fn bench_exact_size_shrink_to_fit(b: &mut Bencher) {
 fn bench_from_str(b: &mut Bencher) {
     let s = "Hello there, the quick brown fox jumped over the lazy dog! \
              Lorem ipsum dolor sit amet, consectetur. ";
-    b.iter(|| {
-        String::from(s)
-    })
+    b.iter(|| String::from(s))
 }
 
 #[bench]
 fn bench_from(b: &mut Bencher) {
     let s = "Hello there, the quick brown fox jumped over the lazy dog! \
              Lorem ipsum dolor sit amet, consectetur. ";
-    b.iter(|| {
-        String::from(s)
-    })
+    b.iter(|| String::from(s))
 }
 
 #[bench]
 fn bench_to_string(b: &mut Bencher) {
     let s = "Hello there, the quick brown fox jumped over the lazy dog! \
              Lorem ipsum dolor sit amet, consectetur. ";
-    b.iter(|| {
-        s.to_string()
-    })
+    b.iter(|| s.to_string())
 }
diff --git a/src/libcollectionstest/vec.rs b/src/libcollectionstest/vec.rs
index 0fb00543ddd..cb99659cc0e 100644
--- a/src/libcollectionstest/vec.rs
+++ b/src/libcollectionstest/vec.rs
@@ -15,7 +15,7 @@ use std::mem::size_of;
 use test::Bencher;
 
 struct DropCounter<'a> {
-    count: &'a mut u32
+    count: &'a mut u32,
 }
 
 impl<'a> Drop for DropCounter<'a> {
@@ -33,17 +33,17 @@ fn test_small_vec_struct() {
 fn test_double_drop() {
     struct TwoVec<T> {
         x: Vec<T>,
-        y: Vec<T>
+        y: Vec<T>,
     }
 
     let (mut count_x, mut count_y) = (0, 0);
     {
         let mut tv = TwoVec {
             x: Vec::new(),
-            y: Vec::new()
+            y: Vec::new(),
         };
-        tv.x.push(DropCounter {count: &mut count_x});
-        tv.y.push(DropCounter {count: &mut count_y});
+        tv.x.push(DropCounter { count: &mut count_x });
+        tv.y.push(DropCounter { count: &mut count_y });
 
         // If Vec had a drop flag, here is where it would be zeroed.
         // Instead, it should rely on its internal state to prevent
@@ -85,12 +85,16 @@ fn test_extend() {
     let mut w = Vec::new();
 
     v.extend(0..3);
-    for i in 0..3 { w.push(i) }
+    for i in 0..3 {
+        w.push(i)
+    }
 
     assert_eq!(v, w);
 
     v.extend(3..10);
-    for i in 3..10 { w.push(i) }
+    for i in 3..10 {
+        w.push(i)
+    }
 
     assert_eq!(v, w);
 
@@ -117,7 +121,7 @@ fn test_extend_ref() {
 fn test_slice_from_mut() {
     let mut values = vec![1, 2, 3, 4, 5];
     {
-        let slice = &mut values[2 ..];
+        let slice = &mut values[2..];
         assert!(slice == [3, 4, 5]);
         for p in slice {
             *p += 2;
@@ -131,7 +135,7 @@ fn test_slice_from_mut() {
 fn test_slice_to_mut() {
     let mut values = vec![1, 2, 3, 4, 5];
     {
-        let slice = &mut values[.. 2];
+        let slice = &mut values[..2];
         assert!(slice == [1, 2]);
         for p in slice {
             *p += 1;
@@ -169,7 +173,7 @@ fn test_split_at_mut() {
 #[test]
 fn test_clone() {
     let v: Vec<i32> = vec![];
-    let w = vec!(1, 2, 3);
+    let w = vec![1, 2, 3];
 
     assert_eq!(v, v.clone());
 
@@ -181,9 +185,9 @@ fn test_clone() {
 
 #[test]
 fn test_clone_from() {
-    let mut v = vec!();
-    let three: Vec<Box<_>> = vec!(box 1, box 2, box 3);
-    let two: Vec<Box<_>> = vec!(box 4, box 5);
+    let mut v = vec![];
+    let three: Vec<Box<_>> = vec![box 1, box 2, box 3];
+    let two: Vec<Box<_>> = vec![box 4, box 5];
     // zero, long
     v.clone_from(&three);
     assert_eq!(v, three);
@@ -235,16 +239,22 @@ fn zero_sized_values() {
     assert_eq!(v.iter_mut().count(), 4);
 
     for &mut () in &mut v {}
-    unsafe { v.set_len(0); }
+    unsafe {
+        v.set_len(0);
+    }
     assert_eq!(v.iter_mut().count(), 0);
 }
 
 #[test]
 fn test_partition() {
-    assert_eq!(vec![].into_iter().partition(|x: &i32| *x < 3), (vec![], vec![]));
-    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 4), (vec![1, 2, 3], vec![]));
-    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 2), (vec![1], vec![2, 3]));
-    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 0), (vec![], vec![1, 2, 3]));
+    assert_eq!(vec![].into_iter().partition(|x: &i32| *x < 3),
+               (vec![], vec![]));
+    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 4),
+               (vec![1, 2, 3], vec![]));
+    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 2),
+               (vec![1], vec![2, 3]));
+    assert_eq!(vec![1, 2, 3].into_iter().partition(|x| *x < 0),
+               (vec![], vec![1, 2, 3]));
 }
 
 #[test]
@@ -264,7 +274,9 @@ fn test_vec_truncate_drop() {
     struct Elem(i32);
     impl Drop for Elem {
         fn drop(&mut self) {
-            unsafe { drops += 1; }
+            unsafe {
+                drops += 1;
+            }
         }
     }
 
@@ -344,7 +356,7 @@ fn test_slice_out_of_bounds_5() {
 #[test]
 #[should_panic]
 fn test_swap_remove_empty() {
-    let mut vec= Vec::<i32>::new();
+    let mut vec = Vec::<i32>::new();
     vec.swap_remove(0);
 }
 
@@ -386,7 +398,7 @@ fn test_drain_items() {
         vec2.push(i);
     }
     assert_eq!(vec, []);
-    assert_eq!(vec2, [ 1, 2, 3 ]);
+    assert_eq!(vec2, [1, 2, 3]);
 }
 
 #[test]
@@ -472,7 +484,7 @@ fn test_into_iter_count() {
 
 #[test]
 fn test_into_iter_clone() {
-    fn iter_equal<I: Iterator<Item=i32>>(it: I, slice: &[i32]) {
+    fn iter_equal<I: Iterator<Item = i32>>(it: I, slice: &[i32]) {
         let v: Vec<i32> = it.collect();
         assert_eq!(&v[..], slice);
     }
diff --git a/src/libcollectionstest/vec_deque.rs b/src/libcollectionstest/vec_deque.rs
index 05af9bd704d..a02666a50c2 100644
--- a/src/libcollectionstest/vec_deque.rs
+++ b/src/libcollectionstest/vec_deque.rs
@@ -52,7 +52,7 @@ fn test_simple() {
 }
 
 #[cfg(test)]
-fn test_parameterized<T:Clone + PartialEq + Debug>(a: T, b: T, c: T, d: T) {
+fn test_parameterized<T: Clone + PartialEq + Debug>(a: T, b: T, c: T, d: T) {
     let mut deq = VecDeque::new();
     assert_eq!(deq.len(), 0);
     deq.push_front(a.clone());
@@ -186,7 +186,7 @@ enum Taggypar<T> {
 struct RecCy {
     x: i32,
     y: i32,
-    t: Taggy
+    t: Taggy,
 }
 
 #[test]
@@ -209,10 +209,26 @@ fn test_param_taggypar() {
 
 #[test]
 fn test_param_reccy() {
-    let reccy1 = RecCy { x: 1, y: 2, t: One(1) };
-    let reccy2 = RecCy { x: 345, y: 2, t: Two(1, 2) };
-    let reccy3 = RecCy { x: 1, y: 777, t: Three(1, 2, 3) };
-    let reccy4 = RecCy { x: 19, y: 252, t: Two(17, 42) };
+    let reccy1 = RecCy {
+        x: 1,
+        y: 2,
+        t: One(1),
+    };
+    let reccy2 = RecCy {
+        x: 345,
+        y: 2,
+        t: Two(1, 2),
+    };
+    let reccy3 = RecCy {
+        x: 1,
+        y: 777,
+        t: Three(1, 2, 3),
+    };
+    let reccy4 = RecCy {
+        x: 19,
+        y: 252,
+        t: Two(17, 42),
+    };
     test_parameterized::<RecCy>(reccy1, reccy2, reccy3, reccy4);
 }
 
@@ -257,13 +273,13 @@ fn test_with_capacity_non_power_two() {
     // underlying Vec which didn't hold and lead
     // to corruption.
     // (Vec grows to next power of two)
-    //good- [9, 12, 15, X, X, X, X, |6]
-    //bug-  [15, 12, X, X, X, |6, X, X]
+    // good- [9, 12, 15, X, X, X, X, |6]
+    // bug-  [15, 12, X, X, X, |6, X, X]
     assert_eq!(d3.pop_front(), Some(6));
 
     // Which leads us to the following state which
     // would be a failure case.
-    //bug-  [15, 12, X, X, X, X, |X, X]
+    // bug-  [15, 12, X, X, X, X, |X, X]
     assert_eq!(d3.front(), Some(&9));
 }
 
@@ -301,7 +317,7 @@ fn test_iter() {
         d.push_back(i);
     }
     {
-        let b: &[_] = &[&0,&1,&2,&3,&4];
+        let b: &[_] = &[&0, &1, &2, &3, &4];
         assert_eq!(d.iter().collect::<Vec<_>>(), b);
     }
 
@@ -309,7 +325,7 @@ fn test_iter() {
         d.push_front(i);
     }
     {
-        let b: &[_] = &[&8,&7,&6,&0,&1,&2,&3,&4];
+        let b: &[_] = &[&8, &7, &6, &0, &1, &2, &3, &4];
         assert_eq!(d.iter().collect::<Vec<_>>(), b);
     }
 
@@ -318,7 +334,10 @@ fn test_iter() {
     loop {
         match it.next() {
             None => break,
-            _ => { len -= 1; assert_eq!(it.size_hint(), (len, Some(len))) }
+            _ => {
+                len -= 1;
+                assert_eq!(it.size_hint(), (len, Some(len)))
+            }
         }
     }
 }
@@ -332,14 +351,14 @@ fn test_rev_iter() {
         d.push_back(i);
     }
     {
-        let b: &[_] = &[&4,&3,&2,&1,&0];
+        let b: &[_] = &[&4, &3, &2, &1, &0];
         assert_eq!(d.iter().rev().collect::<Vec<_>>(), b);
     }
 
     for i in 6..9 {
         d.push_front(i);
     }
-    let b: &[_] = &[&4,&3,&2,&1,&0,&6,&7,&8];
+    let b: &[_] = &[&4, &3, &2, &1, &0, &6, &7, &8];
     assert_eq!(d.iter().rev().collect::<Vec<_>>(), b);
 }
 
@@ -424,7 +443,7 @@ fn test_into_iter() {
             d.push_back(i);
         }
 
-        let b = vec![0,1,2,3,4];
+        let b = vec![0, 1, 2, 3, 4];
         assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
     }
 
@@ -438,7 +457,7 @@ fn test_into_iter() {
             d.push_front(i);
         }
 
-        let b = vec![8,7,6,0,1,2,3,4];
+        let b = vec![8, 7, 6, 0, 1, 2, 3, 4];
         assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
     }
 
@@ -502,7 +521,7 @@ fn test_drain() {
             d.push_front(i);
         }
 
-        assert_eq!(d.drain(..).collect::<Vec<_>>(), [8,7,6,0,1,2,3,4]);
+        assert_eq!(d.drain(..).collect::<Vec<_>>(), [8, 7, 6, 0, 1, 2, 3, 4]);
         assert!(d.is_empty());
     }
 
@@ -532,7 +551,7 @@ fn test_drain() {
 
 #[test]
 fn test_from_iter() {
-    let v = vec!(1,2,3,4,5,6,7);
+    let v = vec![1, 2, 3, 4, 5, 6, 7];
     let deq: VecDeque<_> = v.iter().cloned().collect();
     let u: Vec<_> = deq.iter().cloned().collect();
     assert_eq!(u, v);
@@ -540,7 +559,7 @@ fn test_from_iter() {
     let seq = (0..).step_by(2).take(256);
     let deq: VecDeque<_> = seq.collect();
     for (i, &x) in deq.iter().enumerate() {
-        assert_eq!(2*i, x);
+        assert_eq!(2 * i, x);
     }
     assert_eq!(deq.len(), 256);
 }
@@ -585,20 +604,20 @@ fn test_eq() {
 
 #[test]
 fn test_hash() {
-  let mut x = VecDeque::new();
-  let mut y = VecDeque::new();
+    let mut x = VecDeque::new();
+    let mut y = VecDeque::new();
 
-  x.push_back(1);
-  x.push_back(2);
-  x.push_back(3);
+    x.push_back(1);
+    x.push_back(2);
+    x.push_back(3);
 
-  y.push_back(0);
-  y.push_back(1);
-  y.pop_front();
-  y.push_back(2);
-  y.push_back(3);
+    y.push_back(0);
+    y.push_back(1);
+    y.pop_front();
+    y.push_back(2);
+    y.push_back(3);
 
-  assert!(::hash(&x) == ::hash(&y));
+    assert!(::hash(&x) == ::hash(&y));
 }
 
 #[test]
@@ -665,10 +684,12 @@ fn test_show() {
     let ringbuf: VecDeque<_> = (0..10).collect();
     assert_eq!(format!("{:?}", ringbuf), "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
 
-    let ringbuf: VecDeque<_> = vec!["just", "one", "test", "more"].iter()
-                                                                    .cloned()
-                                                                    .collect();
-    assert_eq!(format!("{:?}", ringbuf), "[\"just\", \"one\", \"test\", \"more\"]");
+    let ringbuf: VecDeque<_> = vec!["just", "one", "test", "more"]
+                                   .iter()
+                                   .cloned()
+                                   .collect();
+    assert_eq!(format!("{:?}", ringbuf),
+               "[\"just\", \"one\", \"test\", \"more\"]");
 }
 
 #[test]
@@ -677,7 +698,9 @@ fn test_drop() {
     struct Elem;
     impl Drop for Elem {
         fn drop(&mut self) {
-            unsafe { drops += 1; }
+            unsafe {
+                drops += 1;
+            }
         }
     }
 
@@ -688,7 +711,7 @@ fn test_drop() {
     ring.push_front(Elem);
     drop(ring);
 
-    assert_eq!(unsafe {drops}, 4);
+    assert_eq!(unsafe { drops }, 4);
 }
 
 #[test]
@@ -697,7 +720,9 @@ fn test_drop_with_pop() {
     struct Elem;
     impl Drop for Elem {
         fn drop(&mut self) {
-            unsafe { drops += 1; }
+            unsafe {
+                drops += 1;
+            }
         }
     }
 
@@ -709,10 +734,10 @@ fn test_drop_with_pop() {
 
     drop(ring.pop_back());
     drop(ring.pop_front());
-    assert_eq!(unsafe {drops}, 2);
+    assert_eq!(unsafe { drops }, 2);
 
     drop(ring);
-    assert_eq!(unsafe {drops}, 4);
+    assert_eq!(unsafe { drops }, 4);
 }
 
 #[test]
@@ -721,7 +746,9 @@ fn test_drop_clear() {
     struct Elem;
     impl Drop for Elem {
         fn drop(&mut self) {
-            unsafe { drops += 1; }
+            unsafe {
+                drops += 1;
+            }
         }
     }
 
@@ -731,10 +758,10 @@ fn test_drop_clear() {
     ring.push_back(Elem);
     ring.push_front(Elem);
     ring.clear();
-    assert_eq!(unsafe {drops}, 4);
+    assert_eq!(unsafe { drops }, 4);
 
     drop(ring);
-    assert_eq!(unsafe {drops}, 4);
+    assert_eq!(unsafe { drops }, 4);
 }
 
 #[test]
@@ -822,7 +849,7 @@ fn test_get_mut() {
 
     match ring.get_mut(1) {
         Some(x) => *x = -1,
-        None => ()
+        None => (),
     };
 
     assert_eq!(ring.get_mut(0), Some(&mut 0));
@@ -852,13 +879,13 @@ fn test_front() {
 fn test_as_slices() {
     let mut ring: VecDeque<i32> = VecDeque::with_capacity(127);
     let cap = ring.capacity() as i32;
-    let first = cap/2;
-    let last  = cap - first;
+    let first = cap / 2;
+    let last = cap - first;
     for i in 0..first {
         ring.push_back(i);
 
         let (left, right) = ring.as_slices();
-        let expected: Vec<_> = (0..i+1).collect();
+        let expected: Vec<_> = (0..i + 1).collect();
         assert_eq!(left, &expected[..]);
         assert_eq!(right, []);
     }
@@ -866,7 +893,7 @@ fn test_as_slices() {
     for j in -last..0 {
         ring.push_front(j);
         let (left, right) = ring.as_slices();
-        let expected_left: Vec<_> = (-last..j+1).rev().collect();
+        let expected_left: Vec<_> = (-last..j + 1).rev().collect();
         let expected_right: Vec<_> = (0..first).collect();
         assert_eq!(left, &expected_left[..]);
         assert_eq!(right, &expected_right[..]);
@@ -880,13 +907,13 @@ fn test_as_slices() {
 fn test_as_mut_slices() {
     let mut ring: VecDeque<i32> = VecDeque::with_capacity(127);
     let cap = ring.capacity() as i32;
-    let first = cap/2;
-    let last  = cap - first;
+    let first = cap / 2;
+    let last = cap - first;
     for i in 0..first {
         ring.push_back(i);
 
         let (left, right) = ring.as_mut_slices();
-        let expected: Vec<_> = (0..i+1).collect();
+        let expected: Vec<_> = (0..i + 1).collect();
         assert_eq!(left, &expected[..]);
         assert_eq!(right, []);
     }
@@ -894,7 +921,7 @@ fn test_as_mut_slices() {
     for j in -last..0 {
         ring.push_front(j);
         let (left, right) = ring.as_mut_slices();
-        let expected_left: Vec<_> = (-last..j+1).rev().collect();
+        let expected_left: Vec<_> = (-last..j + 1).rev().collect();
         let expected_right: Vec<_> = (0..first).collect();
         assert_eq!(left, &expected_left[..]);
         assert_eq!(right, &expected_right[..]);