Skip to content

Commit ad35f0a

Browse files
committed
Run cargo fmt
1 parent a426093 commit ad35f0a

File tree

13 files changed

+168
-120
lines changed

13 files changed

+168
-120
lines changed

src/mount/linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ libc_bitflags!(
8585
MNT_DETACH;
8686
/// Mark the mount point as expired.
8787
MNT_EXPIRE;
88-
/// Don't dereference `target` if it is a symlink.
88+
/// Don't dereference `target` if it is a symlink.
8989
UMOUNT_NOFOLLOW;
9090
}
9191
);

src/sys/aio.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,8 @@ pub fn aio_suspend(
10541054
// generic, and accepting arguments like &[AioWrite]. But that would
10551055
// prevent using aio_suspend to wait on a heterogeneous list of mixed
10561056
// operations.
1057-
let v = list.iter()
1057+
let v = list
1058+
.iter()
10581059
.map(|x| x.as_ref() as *const libc::aiocb)
10591060
.collect::<Vec<*const libc::aiocb>>();
10601061
let p = v.as_ptr();
@@ -1174,7 +1175,10 @@ pub fn aio_suspend(
11741175
/// // notification, we know that all operations are complete.
11751176
/// assert_eq!(aiow.as_mut().aio_return().unwrap(), WBUF.len());
11761177
/// ```
1177-
#[deprecated(since = "0.27.0", note = "https://github.com/nix-rust/nix/issues/2017")]
1178+
#[deprecated(
1179+
since = "0.27.0",
1180+
note = "https://github.com/nix-rust/nix/issues/2017"
1181+
)]
11781182
pub fn lio_listio(
11791183
mode: LioMode,
11801184
list: &mut [Pin<&mut dyn AsMut<libc::aiocb>>],

src/sys/inotify.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ impl Inotify {
143143
pub fn init(flags: InitFlags) -> Result<Inotify> {
144144
let res = Errno::result(unsafe { libc::inotify_init1(flags.bits()) });
145145

146-
res.map(|fd| Inotify { fd: unsafe { OwnedFd::from_raw_fd(fd) } })
146+
res.map(|fd| Inotify {
147+
fd: unsafe { OwnedFd::from_raw_fd(fd) },
148+
})
147149
}
148150

149151
/// Adds a new watch on the target file or directory.
@@ -157,7 +159,11 @@ impl Inotify {
157159
mask: AddWatchFlags,
158160
) -> Result<WatchDescriptor> {
159161
let res = path.with_nix_path(|cstr| unsafe {
160-
libc::inotify_add_watch(self.fd.as_raw_fd(), cstr.as_ptr(), mask.bits())
162+
libc::inotify_add_watch(
163+
self.fd.as_raw_fd(),
164+
cstr.as_ptr(),
165+
mask.bits(),
166+
)
161167
})?;
162168

163169
Errno::result(res).map(|wd| WatchDescriptor { wd })
@@ -237,7 +243,9 @@ impl Inotify {
237243

238244
impl FromRawFd for Inotify {
239245
unsafe fn from_raw_fd(fd: RawFd) -> Self {
240-
Inotify { fd: OwnedFd::from_raw_fd(fd) }
246+
Inotify {
247+
fd: OwnedFd::from_raw_fd(fd),
248+
}
241249
}
242250
}
243251

src/sys/mman.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ use crate::Result;
88
#[cfg(feature = "fs")]
99
use crate::{fcntl::OFlag, sys::stat::Mode};
1010
use libc::{self, c_int, c_void, off_t, size_t};
11-
use std::{num::NonZeroUsize, os::unix::io::{AsRawFd, AsFd}};
11+
use std::{
12+
num::NonZeroUsize,
13+
os::unix::io::{AsFd, AsRawFd},
14+
};
1215

1316
libc_bitflags! {
1417
/// Desired memory protection of a memory mapping.

src/sys/prctl.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ pub fn get_child_subreaper() -> Result<bool> {
5050
// prctl writes into this var
5151
let mut subreaper: c_int = 0;
5252

53-
let res = unsafe { libc::prctl(libc::PR_GET_CHILD_SUBREAPER, &mut subreaper, 0, 0, 0) };
53+
let res = unsafe {
54+
libc::prctl(libc::PR_GET_CHILD_SUBREAPER, &mut subreaper, 0, 0, 0)
55+
};
5456

5557
Errno::result(res).map(|_| subreaper != 0)
5658
}
@@ -78,7 +80,9 @@ pub fn get_keepcaps() -> Result<bool> {
7880

7981
/// Clear the thread memory corruption kill policy and use the system-wide default
8082
pub fn clear_mce_kill() -> Result<()> {
81-
let res = unsafe { libc::prctl(libc::PR_MCE_KILL, libc::PR_MCE_KILL_CLEAR, 0, 0, 0) };
83+
let res = unsafe {
84+
libc::prctl(libc::PR_MCE_KILL, libc::PR_MCE_KILL_CLEAR, 0, 0, 0)
85+
};
8286

8387
Errno::result(res).map(drop)
8488
}
@@ -175,14 +179,16 @@ pub fn get_timerslack() -> Result<i32> {
175179

176180
/// Disable all performance counters attached to the calling process.
177181
pub fn task_perf_events_disable() -> Result<()> {
178-
let res = unsafe { libc::prctl(libc::PR_TASK_PERF_EVENTS_DISABLE, 0, 0, 0, 0) };
182+
let res =
183+
unsafe { libc::prctl(libc::PR_TASK_PERF_EVENTS_DISABLE, 0, 0, 0, 0) };
179184

180185
Errno::result(res).map(drop)
181186
}
182187

183188
/// Enable all performance counters attached to the calling process.
184189
pub fn task_perf_events_enable() -> Result<()> {
185-
let res = unsafe { libc::prctl(libc::PR_TASK_PERF_EVENTS_ENABLE, 0, 0, 0, 0) };
190+
let res =
191+
unsafe { libc::prctl(libc::PR_TASK_PERF_EVENTS_ENABLE, 0, 0, 0, 0) };
186192

187193
Errno::result(res).map(drop)
188194
}

src/sys/signalfd.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::Result;
2121
pub use libc::signalfd_siginfo as siginfo;
2222

2323
use std::mem;
24-
use std::os::unix::io::{AsRawFd, RawFd, FromRawFd, OwnedFd, AsFd, BorrowedFd};
24+
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, OwnedFd, RawFd};
2525

2626
libc_bitflags! {
2727
pub struct SfdFlags: libc::c_int {
@@ -45,18 +45,23 @@ pub const SIGNALFD_SIGINFO_SIZE: usize = mem::size_of::<siginfo>();
4545
///
4646
/// See [the signalfd man page for more information](https://man7.org/linux/man-pages/man2/signalfd.2.html)
4747
#[deprecated(since = "0.27.0", note = "Use SignalFd instead")]
48-
pub fn signalfd<F: AsFd>(fd: Option<F>, mask: &SigSet, flags: SfdFlags) -> Result<OwnedFd> {
48+
pub fn signalfd<F: AsFd>(
49+
fd: Option<F>,
50+
mask: &SigSet,
51+
flags: SfdFlags,
52+
) -> Result<OwnedFd> {
4953
_signalfd(fd, mask, flags)
5054
}
5155

52-
fn _signalfd<F: AsFd>(fd: Option<F>, mask: &SigSet, flags: SfdFlags) -> Result<OwnedFd> {
53-
let raw_fd = fd.map_or(-1, |x|x.as_fd().as_raw_fd());
56+
fn _signalfd<F: AsFd>(
57+
fd: Option<F>,
58+
mask: &SigSet,
59+
flags: SfdFlags,
60+
) -> Result<OwnedFd> {
61+
let raw_fd = fd.map_or(-1, |x| x.as_fd().as_raw_fd());
5462
unsafe {
55-
Errno::result(libc::signalfd(
56-
raw_fd,
57-
mask.as_ref(),
58-
flags.bits(),
59-
)).map(|raw_fd|FromRawFd::from_raw_fd(raw_fd))
63+
Errno::result(libc::signalfd(raw_fd, mask.as_ref(), flags.bits()))
64+
.map(|raw_fd| FromRawFd::from_raw_fd(raw_fd))
6065
}
6166
}
6267

@@ -123,11 +128,8 @@ impl SignalFd {
123128
fn update(&self, mask: &SigSet, flags: SfdFlags) -> Result<()> {
124129
let raw_fd = self.0.as_raw_fd();
125130
unsafe {
126-
Errno::result(libc::signalfd(
127-
raw_fd,
128-
mask.as_ref(),
129-
flags.bits(),
130-
)).map(drop)
131+
Errno::result(libc::signalfd(raw_fd, mask.as_ref(), flags.bits()))
132+
.map(drop)
131133
}
132134
}
133135
}

0 commit comments

Comments
 (0)