about summary refs log tree commit diff
path: root/src/liballoc/tests
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-01-19 20:50:00 +0100
committerJonas Schievink <jonasschievink@gmail.com>2020-01-19 20:50:00 +0100
commite5987a062f487321bdfcbbdac4b0b30548258631 (patch)
treeb2c63d46e62d4865c021f91ed1daaeb5b9034927 /src/liballoc/tests
parent52d6c90488abdd12a24c66f5e3490ae3136bb295 (diff)
downloadrust-e5987a062f487321bdfcbbdac4b0b30548258631.tar.gz
rust-e5987a062f487321bdfcbbdac4b0b30548258631.zip
Format
Diffstat (limited to 'src/liballoc/tests')
-rw-r--r--src/liballoc/tests/linked_list.rs11
-rw-r--r--src/liballoc/tests/vec.rs6
-rw-r--r--src/liballoc/tests/vec_deque.rs5
3 files changed, 9 insertions, 13 deletions
diff --git a/src/liballoc/tests/linked_list.rs b/src/liballoc/tests/linked_list.rs
index c40f99ee906..afcb9e03fd0 100644
--- a/src/liballoc/tests/linked_list.rs
+++ b/src/liballoc/tests/linked_list.rs
@@ -590,13 +590,12 @@ fn drain_filter_pred_panic_leak() {
     q.push_front(D(1));
     q.push_front(D(0));
 
-    catch_unwind(AssertUnwindSafe(|| drop(q.drain_filter(|item| if item.0 >= 2 {
-        panic!()
-    } else {
-        true
-    })))).ok();
+    catch_unwind(AssertUnwindSafe(|| {
+        drop(q.drain_filter(|item| if item.0 >= 2 { panic!() } else { true }))
+    }))
+    .ok();
 
-    assert_eq!(unsafe { DROPS }, 2);  // 0 and 1
+    assert_eq!(unsafe { DROPS }, 2); // 0 and 1
     assert_eq!(q.len(), 6);
 }
 
diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs
index 2a027fd5d2b..9c4ac52acac 100644
--- a/src/liballoc/tests/vec.rs
+++ b/src/liballoc/tests/vec.rs
@@ -783,11 +783,7 @@ fn test_into_iter_leak() {
         }
     }
 
-    let v = vec![
-        D(false),
-        D(true),
-        D(false),
-    ];
+    let v = vec![D(false), D(true), D(false)];
 
     catch_unwind(move || drop(v.into_iter())).ok();
 
diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs
index 07f1f098954..101dd67d97a 100644
--- a/src/liballoc/tests/vec_deque.rs
+++ b/src/liballoc/tests/vec_deque.rs
@@ -2,7 +2,7 @@ use std::collections::TryReserveError::*;
 use std::collections::{vec_deque::Drain, VecDeque};
 use std::fmt::Debug;
 use std::mem::size_of;
-use std::panic::{AssertUnwindSafe, catch_unwind};
+use std::panic::{catch_unwind, AssertUnwindSafe};
 use std::{isize, usize};
 
 use crate::hash;
@@ -1637,7 +1637,8 @@ fn test_drain_leak() {
 
     catch_unwind(AssertUnwindSafe(|| {
         v.drain(1..=4);
-    })).ok();
+    }))
+    .ok();
 
     assert_eq!(unsafe { DROPS }, 4);
     assert_eq!(v.len(), 3);