Skip to content

Commit 347915b

Browse files
committed
format code
1 parent d458ecd commit 347915b

File tree

5 files changed

+204
-204
lines changed

5 files changed

+204
-204
lines changed

src/sys/time.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use std::time::Duration;
77
use std::{cmp, fmt, ops};
88

99
#[cfg(any(
10-
all(feature = "time", any(target_os = "android", target_os = "linux")),
11-
all(
12-
any(
13-
target_os = "freebsd",
14-
target_os = "illumos",
15-
target_os = "linux",
16-
target_os = "netbsd"
17-
),
18-
feature = "time",
19-
feature = "signal"
20-
)
10+
all(feature = "time", any(target_os = "android", target_os = "linux")),
11+
all(
12+
any(
13+
target_os = "freebsd",
14+
target_os = "illumos",
15+
target_os = "linux",
16+
target_os = "netbsd"
17+
),
18+
feature = "time",
19+
feature = "signal"
20+
)
2121
))]
2222
pub(crate) mod timer {
2323
use crate::sys::time::TimeSpec;
@@ -98,10 +98,10 @@ pub(crate) mod timer {
9898
}
9999
}
100100
#[cfg(any(
101-
target_os = "freebsd",
102-
target_os = "netbsd",
103-
target_os = "dragonfly",
104-
target_os = "illumos"
101+
target_os = "freebsd",
102+
target_os = "netbsd",
103+
target_os = "dragonfly",
104+
target_os = "illumos"
105105
))]
106106
bitflags! {
107107
/// Flags that are used for arming the timer.
@@ -114,17 +114,17 @@ pub(crate) mod timer {
114114
fn from(timerspec: TimerSpec) -> Expiration {
115115
match timerspec {
116116
TimerSpec(libc::itimerspec {
117-
it_interval:
118-
libc::timespec {
119-
tv_sec: 0,
120-
tv_nsec: 0,
121-
},
122-
it_value: ts,
123-
}) => Expiration::OneShot(ts.into()),
117+
it_interval:
118+
libc::timespec {
119+
tv_sec: 0,
120+
tv_nsec: 0,
121+
},
122+
it_value: ts,
123+
}) => Expiration::OneShot(ts.into()),
124124
TimerSpec(libc::itimerspec {
125-
it_interval: int_ts,
126-
it_value: val_ts,
127-
}) => {
125+
it_interval: int_ts,
126+
it_value: val_ts,
127+
}) => {
128128
if (int_ts.tv_sec == val_ts.tv_sec)
129129
&& (int_ts.tv_nsec == val_ts.tv_nsec)
130130
{

src/unistd.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ use crate::fcntl::{at_rawfd, AtFlags};
77
#[cfg(feature = "fs")]
88
use crate::fcntl::{fcntl, FcntlArg::F_SETFD, FdFlag, OFlag};
99
#[cfg(all(
10-
feature = "fs",
11-
any(
12-
target_os = "openbsd",
13-
target_os = "netbsd",
14-
target_os = "freebsd",
15-
target_os = "dragonfly",
16-
target_os = "macos",
17-
target_os = "ios"
18-
)
10+
feature = "fs",
11+
any(
12+
target_os = "openbsd",
13+
target_os = "netbsd",
14+
target_os = "freebsd",
15+
target_os = "dragonfly",
16+
target_os = "macos",
17+
target_os = "ios"
18+
)
1919
))]
2020
use crate::sys::stat::FileFlag;
2121
#[cfg(feature = "fs")]
@@ -45,20 +45,20 @@ feature! {
4545
}
4646

4747
#[cfg(any(
48-
target_os = "android",
49-
target_os = "dragonfly",
50-
target_os = "freebsd",
51-
target_os = "linux",
52-
target_os = "openbsd"
48+
target_os = "android",
49+
target_os = "dragonfly",
50+
target_os = "freebsd",
51+
target_os = "linux",
52+
target_os = "openbsd"
5353
))]
5454
pub use self::setres::*;
5555

5656
#[cfg(any(
57-
target_os = "android",
58-
target_os = "dragonfly",
59-
target_os = "freebsd",
60-
target_os = "linux",
61-
target_os = "openbsd"
57+
target_os = "android",
58+
target_os = "dragonfly",
59+
target_os = "freebsd",
60+
target_os = "linux",
61+
target_os = "openbsd"
6262
))]
6363
pub use self::getres::*;
6464

@@ -2752,11 +2752,11 @@ mod pivot_root {
27522752
}
27532753

27542754
#[cfg(any(
2755-
target_os = "android",
2756-
target_os = "dragonfly",
2757-
target_os = "freebsd",
2758-
target_os = "linux",
2759-
target_os = "openbsd"
2755+
target_os = "android",
2756+
target_os = "dragonfly",
2757+
target_os = "freebsd",
2758+
target_os = "linux",
2759+
target_os = "openbsd"
27602760
))]
27612761
mod setres {
27622762
feature! {
@@ -2801,11 +2801,11 @@ mod setres {
28012801
}
28022802

28032803
#[cfg(any(
2804-
target_os = "android",
2805-
target_os = "dragonfly",
2806-
target_os = "freebsd",
2807-
target_os = "linux",
2808-
target_os = "openbsd"
2804+
target_os = "android",
2805+
target_os = "dragonfly",
2806+
target_os = "freebsd",
2807+
target_os = "linux",
2808+
target_os = "openbsd"
28092809
))]
28102810
mod getres {
28112811
feature! {

test/sys/test_ptrace.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[cfg(all(
2-
target_os = "linux",
3-
any(target_arch = "x86_64", target_arch = "x86"),
4-
target_env = "gnu"
2+
target_os = "linux",
3+
any(target_arch = "x86_64", target_arch = "x86"),
4+
target_env = "gnu"
55
))]
66
use memoffset::offset_of;
77
use nix::errno::Errno;
@@ -111,17 +111,17 @@ fn test_ptrace_cont() {
111111
ptrace::cont(child, Some(Signal::SIGKILL)).unwrap();
112112
match waitpid(child, None) {
113113
Ok(WaitStatus::Signaled(pid, Signal::SIGKILL, _))
114-
if pid == child =>
115-
{
116-
// FIXME It's been observed on some systems (apple) the
117-
// tracee may not be killed but remain as a zombie process
118-
// affecting other wait based tests. Add an extra kill just
119-
// to make sure there are no zombies.
114+
if pid == child =>
115+
{
116+
// FIXME It's been observed on some systems (apple) the
117+
// tracee may not be killed but remain as a zombie process
118+
// affecting other wait based tests. Add an extra kill just
119+
// to make sure there are no zombies.
120+
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
121+
while ptrace::cont(child, Some(Signal::SIGKILL)).is_ok() {
120122
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
121-
while ptrace::cont(child, Some(Signal::SIGKILL)).is_ok() {
122-
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
123-
}
124123
}
124+
}
125125
_ => panic!("The process should have been killed"),
126126
}
127127
}
@@ -163,13 +163,13 @@ fn test_ptrace_interrupt() {
163163
ptrace::detach(child, Some(Signal::SIGKILL)).unwrap();
164164
match waitpid(child, None) {
165165
Ok(WaitStatus::Signaled(pid, Signal::SIGKILL, _))
166-
if pid == child =>
167-
{
166+
if pid == child =>
167+
{
168+
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
169+
while ptrace::cont(child, Some(Signal::SIGKILL)).is_ok() {
168170
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
169-
while ptrace::cont(child, Some(Signal::SIGKILL)).is_ok() {
170-
let _ = waitpid(child, Some(WaitPidFlag::WNOHANG));
171-
}
172171
}
172+
}
173173
_ => panic!("The process should have been killed"),
174174
}
175175
}
@@ -178,9 +178,9 @@ fn test_ptrace_interrupt() {
178178

179179
// ptrace::{setoptions, getregs} are only available in these platforms
180180
#[cfg(all(
181-
target_os = "linux",
182-
any(target_arch = "x86_64", target_arch = "x86"),
183-
target_env = "gnu"
181+
target_os = "linux",
182+
any(target_arch = "x86_64", target_arch = "x86"),
183+
target_env = "gnu"
184184
))]
185185
#[test]
186186
fn test_ptrace_syscall() {
@@ -219,18 +219,18 @@ fn test_ptrace_syscall() {
219219
.unwrap();
220220

221221
#[cfg(target_arch = "x86_64")]
222-
let get_syscall_id =
222+
let get_syscall_id =
223223
|| ptrace::getregs(child).unwrap().orig_rax as libc::c_long;
224224

225225
#[cfg(target_arch = "x86")]
226-
let get_syscall_id =
226+
let get_syscall_id =
227227
|| ptrace::getregs(child).unwrap().orig_eax as libc::c_long;
228228

229229
// this duplicates `get_syscall_id` for the purpose of testing `ptrace::read_user`.
230230
#[cfg(target_arch = "x86_64")]
231-
let rax_offset = offset_of!(libc::user_regs_struct, orig_rax);
231+
let rax_offset = offset_of!(libc::user_regs_struct, orig_rax);
232232
#[cfg(target_arch = "x86")]
233-
let rax_offset = offset_of!(libc::user_regs_struct, orig_eax);
233+
let rax_offset = offset_of!(libc::user_regs_struct, orig_eax);
234234

235235
let get_syscall_from_user_area = || {
236236
// Find the offset of `user.regs.rax` (or `user.regs.eax` for x86)

test/test_stat.rs

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use nix::errno::Errno;
2020
#[cfg(not(target_os = "redox"))]
2121
use nix::fcntl;
2222
#[cfg(any(
23-
target_os = "linux",
24-
target_os = "ios",
25-
target_os = "macos",
26-
target_os = "freebsd",
27-
target_os = "netbsd"
23+
target_os = "linux",
24+
target_os = "ios",
25+
target_os = "macos",
26+
target_os = "freebsd",
27+
target_os = "netbsd"
2828
))]
2929
use nix::sys::stat::lutimes;
3030
#[cfg(not(any(target_os = "redox", target_os = "haiku")))]
@@ -234,11 +234,11 @@ fn test_utimes() {
234234

235235
#[test]
236236
#[cfg(any(
237-
target_os = "linux",
238-
target_os = "ios",
239-
target_os = "macos",
240-
target_os = "freebsd",
241-
target_os = "netbsd"
237+
target_os = "linux",
238+
target_os = "ios",
239+
target_os = "macos",
240+
target_os = "freebsd",
241+
target_os = "netbsd"
242242
))]
243243
fn test_lutimes() {
244244
let tempdir = tempfile::tempdir().unwrap();
@@ -299,7 +299,7 @@ fn test_utimensat() {
299299
&TimeSpec::seconds(678),
300300
UtimensatFlags::FollowSymlink,
301301
)
302-
.unwrap();
302+
.unwrap();
303303
assert_times_eq(12345, 678, &fs::metadata(&fullpath).unwrap());
304304

305305
chdir(tempdir.path()).unwrap();
@@ -311,7 +311,7 @@ fn test_utimensat() {
311311
&TimeSpec::seconds(800),
312312
UtimensatFlags::FollowSymlink,
313313
)
314-
.unwrap();
314+
.unwrap();
315315
assert_times_eq(500, 800, &fs::metadata(&fullpath).unwrap());
316316
}
317317

@@ -356,19 +356,19 @@ fn test_mkdirat_fail() {
356356
fcntl::OFlag::O_CREAT,
357357
stat::Mode::empty(),
358358
)
359-
.unwrap();
359+
.unwrap();
360360
let result = mkdirat(dirfd, filename, Mode::S_IRWXU).unwrap_err();
361361
assert_eq!(result, Errno::ENOTDIR);
362362
}
363363

364364
#[test]
365365
#[cfg(not(any(
366-
target_os = "dragonfly",
367-
target_os = "freebsd",
368-
target_os = "ios",
369-
target_os = "macos",
370-
target_os = "haiku",
371-
target_os = "redox"
366+
target_os = "dragonfly",
367+
target_os = "freebsd",
368+
target_os = "ios",
369+
target_os = "macos",
370+
target_os = "haiku",
371+
target_os = "redox"
372372
)))]
373373
fn test_mknod() {
374374
use stat::{lstat, mknod, SFlag};
@@ -384,13 +384,13 @@ fn test_mknod() {
384384

385385
#[test]
386386
#[cfg(not(any(
387-
target_os = "dragonfly",
388-
target_os = "freebsd",
389-
target_os = "illumos",
390-
target_os = "ios",
391-
target_os = "macos",
392-
target_os = "haiku",
393-
target_os = "redox"
387+
target_os = "dragonfly",
388+
target_os = "freebsd",
389+
target_os = "illumos",
390+
target_os = "ios",
391+
target_os = "macos",
392+
target_os = "haiku",
393+
target_os = "redox"
394394
)))]
395395
fn test_mknodat() {
396396
use fcntl::{AtFlags, OFlag};
@@ -408,14 +408,14 @@ fn test_mknodat() {
408408
Mode::S_IRWXU,
409409
0,
410410
)
411-
.unwrap();
411+
.unwrap();
412412
let mode = fstatat(
413413
target_dir.as_raw_fd(),
414414
file_name,
415415
AtFlags::AT_SYMLINK_NOFOLLOW,
416416
)
417-
.unwrap()
418-
.st_mode as mode_t;
417+
.unwrap()
418+
.st_mode as mode_t;
419419
assert_eq!(mode & libc::S_IFREG, libc::S_IFREG);
420420
assert_eq!(mode & libc::S_IRWXU, libc::S_IRWXU);
421421
}

0 commit comments

Comments
 (0)