Skip to content

Commit dde77db

Browse files
committed
fix tests/run formatting
1 parent 307ebca commit dde77db

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

tests/run/int.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ fn main() {
77
use std::hint::black_box;
88

99
macro_rules! check {
10-
($ty:ty, $expr:expr) => {
11-
{
12-
const EXPECTED: $ty = $expr;
13-
assert_eq!($expr, EXPECTED);
14-
}
15-
};
10+
($ty:ty, $expr:expr) => {{
11+
const EXPECTED: $ty = $expr;
12+
assert_eq!($expr, EXPECTED);
13+
}};
1614
}
1715

1816
check!(u32, (2220326408_u32 + black_box(1)) >> (32 - 6));

tests/run/int_overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn main() {
1212

1313
let arg_count = std::env::args().count();
1414
let int = isize::MAX;
15-
let _int = int + arg_count as isize; // overflow
15+
let _int = int + arg_count as isize; // overflow
1616

1717
// If overflow checking is disabled, we should reach here.
1818
#[cfg(not(debug_assertions))]

tests/run/structs.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,8 @@ fn one() -> isize {
2727

2828
#[no_mangle]
2929
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
30-
let test = Test {
31-
field: one(),
32-
};
33-
let two = Two {
34-
two: 2,
35-
};
30+
let test = Test { field: one() };
31+
let two = Two { two: 2 };
3632
unsafe {
3733
libc::printf(b"%ld\n\0" as *const u8 as *const i8, test.field);
3834
libc::printf(b"%ld\n\0" as *const u8 as *const i8, two.two);

tests/run/volatile.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@ struct Struct {
1212
func: unsafe fn(*const ()),
1313
}
1414

15-
fn func(_ptr: *const ()) {
16-
}
15+
fn func(_ptr: *const ()) {}
1716

1817
fn main() {
1918
let mut x = MaybeUninit::<&Struct>::uninit();
20-
x.write(&Struct {
21-
pointer: std::ptr::null(),
22-
func,
23-
});
19+
x.write(&Struct { pointer: std::ptr::null(), func });
2420
let x = unsafe { x.assume_init() };
2521
let value = unsafe { (x as *const Struct).read_volatile() };
2622
println!("{:?}", value);

tests/run/volatile2.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ mod libc {
77
#[link(name = "c")]
88
extern "C" {
99
pub fn sigaction(signum: i32, act: *const sigaction, oldact: *mut sigaction) -> i32;
10-
pub fn mmap(addr: *mut (), len: usize, prot: i32, flags: i32, fd: i32, offset: i64) -> *mut ();
10+
pub fn mmap(
11+
addr: *mut (),
12+
len: usize,
13+
prot: i32,
14+
flags: i32,
15+
fd: i32,
16+
offset: i64,
17+
) -> *mut ();
1118
pub fn mprotect(addr: *mut (), len: usize, prot: i32) -> i32;
1219
}
1320

@@ -54,7 +61,8 @@ fn main() {
5461
libc::MAP_PRIVATE | libc::MAP_ANONYMOUS,
5562
-1,
5663
0,
57-
).cast();
64+
)
65+
.cast();
5866
if STORAGE == libc::MAP_FAILED {
5967
panic!("error: mmap failed");
6068
}

0 commit comments

Comments
 (0)