Skip to content

Commit

Permalink
Move some pure formatting changes out of nix-rust#1863
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Dec 4, 2022
1 parent bedf83b commit 6ba8274
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 123 deletions.
2 changes: 1 addition & 1 deletion src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl Entry {

/// Returns the bare file name of this directory entry without any other leading path component.
pub fn file_name(&self) -> &ffi::CStr {
unsafe { ::std::ffi::CStr::from_ptr(self.0.d_name.as_ptr()) }
unsafe { ffi::CStr::from_ptr(self.0.d_name.as_ptr()) }
}

/// Returns the type of this directory entry, if known.
Expand Down
7 changes: 2 additions & 5 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pub fn renameat<P1: ?Sized + NixPath, P2: ?Sized + NixPath>(
}
}

#[cfg(all(target_os = "linux", target_env = "gnu",))]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
#[cfg(feature = "fs")]
libc_bitflags! {
#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
Expand All @@ -250,10 +250,7 @@ libc_bitflags! {

feature! {
#![feature = "fs"]
#[cfg(all(
target_os = "linux",
target_env = "gnu",
))]
#[cfg(all(target_os = "linux", target_env = "gnu"))]
pub fn renameat2<P1: ?Sized + NixPath, P2: ?Sized + NixPath>(
old_dirfd: Option<RawFd>,
old_path: &P1,
Expand Down
18 changes: 6 additions & 12 deletions src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2221,14 +2221,14 @@ pub fn recvfrom<T: SockaddrLike>(
buf.as_ptr() as *mut c_void,
buf.len() as size_t,
0,
addr.as_mut_ptr() as *mut libc::sockaddr,
addr.as_mut_ptr() as *mut sockaddr,
&mut len as *mut socklen_t,
))? as usize;

Ok((
ret,
T::from_raw(
addr.assume_init().as_ptr() as *const libc::sockaddr,
addr.assume_init().as_ptr() as *const sockaddr,
Some(len),
),
))
Expand Down Expand Up @@ -2336,11 +2336,8 @@ pub fn getpeername<T: SockaddrLike>(fd: RawFd) -> Result<T> {
let mut addr = mem::MaybeUninit::<T>::uninit();
let mut len = T::size();

let ret = libc::getpeername(
fd,
addr.as_mut_ptr() as *mut libc::sockaddr,
&mut len,
);
let ret =
libc::getpeername(fd, addr.as_mut_ptr() as *mut sockaddr, &mut len);

Errno::result(ret)?;

Expand All @@ -2356,11 +2353,8 @@ pub fn getsockname<T: SockaddrLike>(fd: RawFd) -> Result<T> {
let mut addr = mem::MaybeUninit::<T>::uninit();
let mut len = T::size();

let ret = libc::getsockname(
fd,
addr.as_mut_ptr() as *mut libc::sockaddr,
&mut len,
);
let ret =
libc::getsockname(fd, addr.as_mut_ptr() as *mut sockaddr, &mut len);

Errno::result(ret)?;

Expand Down
Loading

0 comments on commit 6ba8274

Please sign in to comment.