From f2a2291275fb3dce9f32d2d00626cbf1916def43 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 12 Apr 2023 11:04:04 -0700 Subject: [PATCH] Fix some clippy lints. --- cap-fs-ext/src/dir_ext.rs | 10 +++++----- cap-net-ext/src/lib.rs | 2 +- cap-primitives/src/rustix/linux/fs/open_impl.rs | 2 +- cap-tempfile/src/utf8.rs | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cap-fs-ext/src/dir_ext.rs b/cap-fs-ext/src/dir_ext.rs index 88d2fd17..c28fd4c0 100644 --- a/cap-fs-ext/src/dir_ext.rs +++ b/cap-fs-ext/src/dir_ext.rs @@ -982,7 +982,7 @@ impl DirExtUtf8 for cap_std::fs_utf8::Dir { &self.as_filelike_view::(), path.as_ref().as_ref(), ) { - Ok(file) => Ok(Self::from_std_file(file.into())), + Ok(file) => Ok(Self::from_std_file(file)), Err(e) => Err(e), } } @@ -1045,7 +1045,7 @@ impl AsyncDirExtUtf8 for cap_async_std::fs_utf8::Dir { spawn_blocking(move || { set_times( &clone.as_filelike_view::(), - &path, + path, Some(atime), None, ) @@ -1064,7 +1064,7 @@ impl AsyncDirExtUtf8 for cap_async_std::fs_utf8::Dir { spawn_blocking(move || { set_times( &clone.as_filelike_view::(), - &path, + path, None, Some(mtime), ) @@ -1084,7 +1084,7 @@ impl AsyncDirExtUtf8 for cap_async_std::fs_utf8::Dir { spawn_blocking(move || { set_times( &clone.as_filelike_view::(), - &path, + path, atime, mtime, ) @@ -1104,7 +1104,7 @@ impl AsyncDirExtUtf8 for cap_async_std::fs_utf8::Dir { spawn_blocking(move || { set_times_nofollow( &clone.as_filelike_view::(), - &path, + path, atime, mtime, ) diff --git a/cap-net-ext/src/lib.rs b/cap-net-ext/src/lib.rs index 0c90f4c2..b4ff1efc 100644 --- a/cap-net-ext/src/lib.rs +++ b/cap-net-ext/src/lib.rs @@ -336,7 +336,7 @@ impl PoolExt for Pool { for addr in addrs { self._pool().check_addr(&addr)?; - match rustix::net::connect(&socket, &addr) { + match rustix::net::connect(socket, &addr) { Ok(()) => return Ok(()), Err(err) => last_err = Some(err), } diff --git a/cap-primitives/src/rustix/linux/fs/open_impl.rs b/cap-primitives/src/rustix/linux/fs/open_impl.rs index 515f5a76..d8611e38 100644 --- a/cap-primitives/src/rustix/linux/fs/open_impl.rs +++ b/cap-primitives/src/rustix/linux/fs/open_impl.rs @@ -37,7 +37,7 @@ pub(crate) fn open_impl( // If we got anything other than a `ENOSYS` error, that's our result. match result { Err(err) if err.raw_os_error() == Some(rustix::io::Errno::NOSYS.raw_os_error()) => {} - Err(err) => return Err(err.into()), + Err(err) => return Err(err), Ok(fd) => return Ok(fd), } } diff --git a/cap-tempfile/src/utf8.rs b/cap-tempfile/src/utf8.rs index 6cb5ecd9..bdae30b2 100644 --- a/cap-tempfile/src/utf8.rs +++ b/cap-tempfile/src/utf8.rs @@ -71,9 +71,9 @@ impl TempDir { pub fn new_in(dir: &Dir) -> io::Result { for _ in 0..Self::num_iterations() { let name = &Self::new_name(); - match dir.create_dir(&name) { + match dir.create_dir(name) { Ok(()) => { - let dir = match dir.open_dir(&name) { + let dir = match dir.open_dir(name) { Ok(dir) => dir, Err(e) => { dir.remove_dir(name).ok();