Skip to content

Commit 4eb1ab9

Browse files
committed
Format tests and benches with rustfmt (1-50 of 300)
1 parent 2baabf7 commit 4eb1ab9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+129
-127
lines changed

bench-cargo-miri/mse/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ fn mse(samples: usize, frame_buf: &[i16], buf_ref: &[u8]) -> f64 {
2828
}
2929
mse / max_samples as f64
3030
}
31-

benches/helpers/repeat_manual.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
fn main() {
22
let mut data: [u8; 1024] = unsafe { std::mem::uninitialized() };
33
for i in 0..data.len() {
4-
unsafe { std::ptr::write(&mut data[i], 0); }
4+
unsafe {
5+
std::ptr::write(&mut data[i], 0);
6+
}
57
}
68
assert_eq!(data.len(), 1024);
79
}

test-cargo-miri/cdylib/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ use byteorder::{BigEndian, ByteOrder};
22

33
#[no_mangle]
44
extern "C" fn use_the_dependency() {
5-
let _n = <BigEndian as ByteOrder>::read_u64(&[1,2,3,4,5,6,7,8]);
5+
let _n = <BigEndian as ByteOrder>::read_u64(&[1, 2, 3, 4, 5, 6, 7, 8]);
66
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use byteorder::{BigEndian, ByteOrder};
22

33
pub fn use_the_dependency() {
4-
let _n = <BigEndian as ByteOrder>::read_u32(&[1,2,3,4]);
4+
let _n = <BigEndian as ByteOrder>::read_u32(&[1, 2, 3, 4]);
55
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use byteorder::{LittleEndian, ByteOrder};
1+
use byteorder::{ByteOrder, LittleEndian};
22

33
pub fn use_the_dependency() {
4-
let _n = <LittleEndian as ByteOrder>::read_u32(&[1,2,3,4]);
4+
let _n = <LittleEndian as ByteOrder>::read_u32(&[1, 2, 3, 4]);
55
}

test-cargo-miri/issue-rust-86261/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Regression test for https://github.com/rust-lang/rust/issues/86261:
44
// `#[no_mangle]` on a `use` item.
55
#[no_mangle]
6-
use std::{thread,panic, io, boxed, any, string};
6+
use std::{any, boxed, io, panic, string, thread};
77

88
// `#[no_mangle]` on a struct has a similar problem.
99
#[no_mangle]

test-cargo-miri/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() {
88
assert_eq!(env!("MIRITESTVAR"), "testval");
99

1010
// Exercise external crate, printing to stdout.
11-
let buf = &[1,2,3,4];
11+
let buf = &[1, 2, 3, 4];
1212
let n = <BigEndian as ByteOrder>::read_u32(buf);
1313
assert_eq!(n, 0x01020304);
1414
println!("{:#010x}", n);
@@ -32,7 +32,7 @@ fn main() {
3232
#[cfg(unix)]
3333
for line in io::stdin().lock().lines() {
3434
let num: i32 = line.unwrap().parse().unwrap();
35-
println!("{}", 2*num);
35+
println!("{}", 2 * num);
3636
}
3737
// On non-Unix, reading from stdin is not supported. So we hard-code the right answer.
3838
#[cfg(not(unix))]

test-cargo-miri/tests/test.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,5 @@ fn page_size() {
6767
let page_size = page_size::get();
6868

6969
// In particular, this checks that it is not 0.
70-
assert!(
71-
page_size.is_power_of_two(),
72-
"page size not a power of two: {}",
73-
page_size
74-
);
70+
assert!(page_size.is_power_of_two(), "page size not a power of two: {}", page_size);
7571
}

tests/fail/abort-terminator.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// error-pattern: the program aborted
22
#![feature(c_unwind)]
33

4-
extern "C" fn panic_abort() { panic!() }
4+
extern "C" fn panic_abort() {
5+
panic!()
6+
}
57

68
fn main() {
79
panic_abort();

tests/fail/alloc/global_system_mixup.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88

99
#![feature(allocator_api, slice_ptr_get)]
1010

11-
use std::alloc::{Allocator, Global, System, Layout};
11+
use std::alloc::{Allocator, Global, Layout, System};
1212

1313
fn main() {
1414
let l = Layout::from_size_align(1, 1).unwrap();
1515
let ptr = Global.allocate(l).unwrap().as_non_null_ptr();
16-
unsafe { System.deallocate(ptr, l); }
16+
unsafe {
17+
System.deallocate(ptr, l);
18+
}
1719
}

0 commit comments

Comments
 (0)