Skip to content

Commit a78e120

Browse files
committed
rustfmt tests/run-pass-valgrind/.
1 parent d161d06 commit a78e120

13 files changed

+57
-27
lines changed

rustfmt.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ ignore = [
1717
"/tests/incremental/", # These tests are somewhat sensitive to source code layout.
1818
"/tests/pretty/", # These tests are very sensitive to source code layout.
1919
"/tests/run-make/translation/test.rs", # This test contains syntax errors.
20-
"/tests/run-pass-valgrind/",
2120
"/tests/rustdoc/",
2221
"/tests/rustdoc-gui/",
2322
"/tests/rustdoc-js/",

tests/run-pass-valgrind/cast-enum-with-dtor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
// check dtor calling order when casting enums.
44

5+
use std::mem;
56
use std::sync::atomic;
67
use std::sync::atomic::Ordering;
7-
use std::mem;
88

99
enum E {
1010
A = 0,
1111
B = 1,
12-
C = 2
12+
C = 2,
1313
}
1414

1515
static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
@@ -19,7 +19,7 @@ impl Drop for E {
1919
// avoid dtor loop
2020
unsafe { mem::forget(mem::replace(self, E::B)) };
2121

22-
FLAG.store(FLAG.load(Ordering::SeqCst)+1, Ordering::SeqCst);
22+
FLAG.store(FLAG.load(Ordering::SeqCst) + 1, Ordering::SeqCst);
2323
}
2424
}
2525

tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ static mut DROP_RAN: bool = false;
77
struct Foo;
88
impl Drop for Foo {
99
fn drop(&mut self) {
10-
unsafe { DROP_RAN = true; }
10+
unsafe {
11+
DROP_RAN = true;
12+
}
1113
}
1214
}
1315

14-
15-
trait Trait { fn dummy(&self) { } }
16+
trait Trait {
17+
fn dummy(&self) {}
18+
}
1619
impl Trait for Foo {}
1720

1821
pub fn main() {

tests/run-pass-valgrind/coerce-match-calls.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ use std::boxed::Box;
77
pub fn main() {
88
let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
99

10-
let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
10+
let _: Box<[isize]> = match true {
11+
true => Box::new([1, 2, 3]),
12+
false => Box::new([1]),
13+
};
1114

1215
// Check we don't get over-keen at propagating coercions in the case of casts.
1316
let x = if true { 42 } else { 42u8 } as u16;
14-
let x = match true { true => 42, false => 42u8 } as u16;
17+
let x = match true {
18+
true => 42,
19+
false => 42u8,
20+
} as u16;
1521
}

tests/run-pass-valgrind/coerce-match.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ pub fn main() {
1212
};
1313

1414
let _: Box<[isize]> = match true {
15-
true => { let b: Box<_> = Box::new([1, 2, 3]); b }
16-
false => { let b: Box<_> = Box::new([1]); b }
15+
true => {
16+
let b: Box<_> = Box::new([1, 2, 3]);
17+
b
18+
}
19+
false => {
20+
let b: Box<_> = Box::new([1]);
21+
b
22+
}
1723
};
1824

1925
// Check we don't get over-keen at propagating coercions in the case of casts.
2026
let x = if true { 42 } else { 42u8 } as u16;
21-
let x = match true { true => 42, false => 42u8 } as u16;
27+
let x = match true {
28+
true => 42,
29+
false => 42u8,
30+
} as u16;
2231
}

tests/run-pass-valgrind/down-with-thread-dtors.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ impl Drop for Bar {
2727

2828
impl Drop for Baz {
2929
fn drop(&mut self) {
30-
unsafe { HIT = true; }
30+
unsafe {
31+
HIT = true;
32+
}
3133
}
3234
}
3335

3436
fn main() {
3537
std::thread::spawn(|| {
3638
FOO.with(|_| {});
37-
}).join().unwrap();
39+
})
40+
.join()
41+
.unwrap();
3842
assert!(unsafe { HIT });
3943
}

tests/run-pass-valgrind/dst-dtor-1.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ static mut DROP_RAN: bool = false;
33
struct Foo;
44
impl Drop for Foo {
55
fn drop(&mut self) {
6-
unsafe { DROP_RAN = true; }
6+
unsafe {
7+
DROP_RAN = true;
8+
}
79
}
810
}
911

10-
trait Trait { fn dummy(&self) { } }
12+
trait Trait {
13+
fn dummy(&self) {}
14+
}
1115
impl Trait for Foo {}
1216

1317
struct Fat<T: ?Sized> {
14-
f: T
18+
f: T,
1519
}
1620

1721
pub fn main() {

tests/run-pass-valgrind/dst-dtor-2.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ static mut DROP_RAN: isize = 0;
33
struct Foo;
44
impl Drop for Foo {
55
fn drop(&mut self) {
6-
unsafe { DROP_RAN += 1; }
6+
unsafe {
7+
DROP_RAN += 1;
8+
}
79
}
810
}
911

1012
struct Fat<T: ?Sized> {
11-
f: T
13+
f: T,
1214
}
1315

1416
pub fn main() {

tests/run-pass-valgrind/dst-dtor-3.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ static mut DROP_RAN: bool = false;
55
struct Foo;
66
impl Drop for Foo {
77
fn drop(&mut self) {
8-
unsafe { DROP_RAN = true; }
8+
unsafe {
9+
DROP_RAN = true;
10+
}
911
}
1012
}
1113

12-
trait Trait { fn dummy(&self) { } }
14+
trait Trait {
15+
fn dummy(&self) {}
16+
}
1317
impl Trait for Foo {}
1418

1519
pub fn main() {

tests/run-pass-valgrind/dst-dtor-4.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ static mut DROP_RAN: isize = 0;
55
struct Foo;
66
impl Drop for Foo {
77
fn drop(&mut self) {
8-
unsafe { DROP_RAN += 1; }
8+
unsafe {
9+
DROP_RAN += 1;
10+
}
911
}
1012
}
1113

tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ impl FnOnce<()> for D {
4343
}
4444
}
4545

46-
4746
fn main() {
4847
let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
4948
assert_eq!(x.call_once(()), format!("hello"));

tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call2.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ impl FnOnce<(String, Box<str>)> for D {
5151
}
5252
}
5353

54-
5554
fn main() {
5655
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
5756
let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
@@ -61,10 +60,10 @@ fn main() {
6160
assert_eq!(x.call_once((s1, s2)), format!("42"));
6261
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
6362
let x = *(Box::new(C(format!("jumping fox")))
64-
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
63+
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
6564
assert_eq!(x.call_once((s1, s2)), format!("jumping fox"));
6665
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
6766
let x = *(Box::new(D(Box::new(format!("lazy dog"))))
68-
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
67+
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
6968
assert_eq!(x.call_once((s1, s2)), format!("lazy dog"));
7069
}

tests/run-pass-valgrind/unsized-locals/by-value-trait-objects.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ impl Foo for D {
3636
}
3737
}
3838

39-
4039
fn main() {
4140
let x = *(Box::new(A) as Box<dyn Foo>);
4241
assert_eq!(x.foo(), format!("hello"));

0 commit comments

Comments
 (0)