Skip to content

Commit

Permalink
Clippy cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers authored and rtzoeller committed Dec 2, 2022
1 parent fbf8ffc commit 9a4ca6e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,7 @@ pub fn fspacectl_all(fd: RawFd, offset: libc::off_t, len: libc::off_t)
0, // No flags are currently supported
&mut rqsr
)};
if let Err(e) = Errno::result(res) {
return Err(e);
}
Errno::result(res)?;
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ pub fn sendmsg<S>(fd: RawFd, iov: &[IoSlice<'_>], cmsgs: &[ControlMessage],
// because subsequent code will not clear the padding bytes.
let mut cmsg_buffer = vec![0u8; capacity];

let mhdr = pack_mhdr_to_send(&mut cmsg_buffer[..], &iov, &cmsgs, addr);
let mhdr = pack_mhdr_to_send(&mut cmsg_buffer[..], iov, cmsgs, addr);

let ret = unsafe { libc::sendmsg(fd, &mhdr, flags.bits()) };

Expand Down
2 changes: 1 addition & 1 deletion src/sys/socket/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ struct SetBool {

impl<'a> Set<'a, bool> for SetBool {
fn new(val: &'a bool) -> SetBool {
SetBool { val: if *val { 1 } else { 0 } }
SetBool { val: i32::from(*val) }
}

fn ffi_ptr(&self) -> *const c_void {
Expand Down
6 changes: 2 additions & 4 deletions test/test_fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@ fn test_readlink() {
let src = tempdir.path().join("a");
let dst = tempdir.path().join("b");
println!("a: {:?}, b: {:?}", &src, &dst);
fs::symlink(&src.as_path(), &dst.as_path()).unwrap();
let dirfd = open(tempdir.path(),
OFlag::empty(),
Mode::empty()).unwrap();
fs::symlink(src.as_path(), dst.as_path()).unwrap();
let dirfd = open(tempdir.path(), OFlag::empty(), Mode::empty()).unwrap();
let expected_dir = src.to_str().unwrap();

assert_eq!(readlink(&dst).unwrap().to_str().unwrap(), expected_dir);
Expand Down

0 comments on commit 9a4ca6e

Please sign in to comment.