Skip to content

Commit d01d593

Browse files
committed
rustfmt unistd.rs
1 parent e1def7b commit d01d593

File tree

1 file changed

+44
-33
lines changed

1 file changed

+44
-33
lines changed

src/unistd.rs

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,53 @@
11
//! Safe wrappers around functions found in libc "unistd.h" header
22
3-
#[cfg(not(target_os = "redox"))]
4-
use cfg_if::cfg_if;
53
use crate::errno::{self, Errno};
6-
use crate::{Error, Result, NixPath};
74
#[cfg(not(target_os = "redox"))]
85
#[cfg(feature = "fs")]
9-
use crate::fcntl::{AtFlags, at_rawfd};
10-
use libc::{self, c_char, c_void, c_int, c_long, c_uint, size_t, pid_t, off_t,
11-
uid_t, gid_t, mode_t, PATH_MAX};
6+
use crate::fcntl::{at_rawfd, AtFlags};
127
#[cfg(feature = "fs")]
13-
use crate::fcntl::{FdFlag, OFlag, fcntl, FcntlArg::F_SETFD};
14-
use std::{fmt, mem, ptr};
8+
use crate::fcntl::{fcntl, FcntlArg::F_SETFD, FdFlag, OFlag};
9+
#[cfg(feature = "fs")]
10+
use crate::sys::stat::Mode;
11+
use crate::{Error, NixPath, Result};
12+
#[cfg(not(target_os = "redox"))]
13+
use cfg_if::cfg_if;
14+
use libc::{
15+
self, c_char, c_int, c_long, c_uint, c_void, gid_t, mode_t, off_t, pid_t, size_t, uid_t,
16+
PATH_MAX,
17+
};
1518
use std::convert::Infallible;
1619
use std::ffi::{CStr, OsString};
1720
#[cfg(not(target_os = "redox"))]
1821
use std::ffi::{CString, OsStr};
19-
use std::os::unix::ffi::OsStringExt;
2022
#[cfg(not(target_os = "redox"))]
2123
use std::os::unix::ffi::OsStrExt;
24+
use std::os::unix::ffi::OsStringExt;
2225
use std::os::unix::io::RawFd;
2326
use std::path::PathBuf;
24-
#[cfg(feature = "fs")]
25-
use crate::sys::stat::Mode;
27+
use std::{fmt, mem, ptr};
2628

2729
feature! {
2830
#![feature = "fs"]
2931
#[cfg(any(target_os = "android", target_os = "linux"))]
3032
pub use self::pivot_root::*;
3133
}
3234

33-
#[cfg(any(target_os = "android",
34-
target_os = "dragonfly",
35-
target_os = "freebsd",
36-
target_os = "linux",
37-
target_os = "openbsd"))]
35+
#[cfg(any(
36+
target_os = "android",
37+
target_os = "dragonfly",
38+
target_os = "freebsd",
39+
target_os = "linux",
40+
target_os = "openbsd"
41+
))]
3842
pub use self::setres::*;
3943

40-
#[cfg(any(target_os = "android",
41-
target_os = "dragonfly",
42-
target_os = "freebsd",
43-
target_os = "linux",
44-
target_os = "openbsd"))]
44+
#[cfg(any(
45+
target_os = "android",
46+
target_os = "dragonfly",
47+
target_os = "freebsd",
48+
target_os = "linux",
49+
target_os = "openbsd"
50+
))]
4551
pub use self::getres::*;
4652

4753
feature! {
@@ -373,6 +379,7 @@ pub fn setpgid(pid: Pid, pgid: Pid) -> Result<()> {
373379
let res = unsafe { libc::setpgid(pid.into(), pgid.into()) };
374380
Errno::result(res).map(drop)
375381
}
382+
376383
#[inline]
377384
pub fn getpgid(pid: Option<Pid>) -> Result<Pid> {
378385
let res = unsafe { libc::getpgid(pid.unwrap_or(Pid(0)).into()) };
@@ -672,7 +679,7 @@ fn reserve_double_buffer_size<T>(buf: &mut Vec<T>, limit: usize) -> Result<()> {
672679
use std::cmp::min;
673680

674681
if buf.capacity() >= limit {
675-
return Err(Errno::ERANGE)
682+
return Err(Errno::ERANGE);
676683
}
677684

678685
let capacity = min(buf.capacity() * 2, limit);
@@ -2776,11 +2783,13 @@ mod pivot_root {
27762783
}
27772784
}
27782785

2779-
#[cfg(any(target_os = "android",
2780-
target_os = "dragonfly",
2781-
target_os = "freebsd",
2782-
target_os = "linux",
2783-
target_os = "openbsd"))]
2786+
#[cfg(any(
2787+
target_os = "android",
2788+
target_os = "dragonfly",
2789+
target_os = "freebsd",
2790+
target_os = "linux",
2791+
target_os = "openbsd"
2792+
))]
27842793
mod setres {
27852794
feature! {
27862795
#![feature = "user"]
@@ -2823,11 +2832,13 @@ mod setres {
28232832
}
28242833
}
28252834

2826-
#[cfg(any(target_os = "android",
2827-
target_os = "dragonfly",
2828-
target_os = "freebsd",
2829-
target_os = "linux",
2830-
target_os = "openbsd"))]
2835+
#[cfg(any(
2836+
target_os = "android",
2837+
target_os = "dragonfly",
2838+
target_os = "freebsd",
2839+
target_os = "linux",
2840+
target_os = "openbsd"
2841+
))]
28312842
mod getres {
28322843
feature! {
28332844
#![feature = "user"]
@@ -2893,7 +2904,7 @@ mod getres {
28932904
}
28942905

28952906
#[cfg(feature = "fs")]
2896-
libc_bitflags!{
2907+
libc_bitflags! {
28972908
/// Options for access()
28982909
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
28992910
pub struct AccessFlags : c_int {

0 commit comments

Comments
 (0)