diff options
author | Allen Webb <allenwebb@google.com> | 2021-04-15 10:52:51 -0500 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-16 15:14:25 +0000 |
commit | a09d09c6dc08a3e108976c73933b2440e738ccb8 (patch) | |
tree | 73e6d4a7176a8a868cb5151f35e2aed3a2d61aec | |
parent | 1a5b735c97aa136991acfbcaa99d08367921887f (diff) | |
download | crosvm-a09d09c6dc08a3e108976c73933b2440e738ccb8.tar.gz |
sys_util: Fix clippy errors for dev-lang/rust-1.51.0
BUG=None
TEST=cargo clippy && cargo test
Change-Id: I7d73176469baedaaf847ddaae73f959c173d67a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2827974
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Allen Webb <allenwebb@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Allen Webb <allenwebb@google.com>
-rw-r--r-- | sys_util/src/descriptor.rs | 12 | ||||
-rw-r--r-- | sys_util/src/descriptor_reflection.rs | 6 | ||||
-rw-r--r-- | sys_util/src/linux/syslog.rs | 2 | ||||
-rw-r--r-- | sys_util/src/mmap.rs | 6 | ||||
-rw-r--r-- | sys_util/src/shm.rs | 6 |
5 files changed, 16 insertions, 16 deletions
diff --git a/sys_util/src/descriptor.rs b/sys_util/src/descriptor.rs index e22d83b9f..325b2b450 100644 --- a/sys_util/src/descriptor.rs +++ b/sys_util/src/descriptor.rs @@ -140,17 +140,17 @@ impl SafeDescriptor { } } -impl Into<File> for SafeDescriptor { - fn into(self) -> File { +impl From<SafeDescriptor> for File { + fn from(s: SafeDescriptor) -> File { // Safe because we own the SafeDescriptor at this point. - unsafe { File::from_raw_fd(self.into_raw_descriptor()) } + unsafe { File::from_raw_fd(s.into_raw_descriptor()) } } } -impl Into<SafeDescriptor> for File { - fn into(self) -> SafeDescriptor { +impl From<File> for SafeDescriptor { + fn from(f: File) -> SafeDescriptor { // Safe because we own the File at this point. - unsafe { SafeDescriptor::from_raw_descriptor(self.into_raw_descriptor()) } + unsafe { SafeDescriptor::from_raw_descriptor(f.into_raw_descriptor()) } } } diff --git a/sys_util/src/descriptor_reflection.rs b/sys_util/src/descriptor_reflection.rs index 207eb0eb3..af367c6f7 100644 --- a/sys_util/src/descriptor_reflection.rs +++ b/sys_util/src/descriptor_reflection.rs @@ -404,9 +404,9 @@ impl From<File> for FileSerdeWrapper { } } -impl Into<File> for FileSerdeWrapper { - fn into(self) -> File { - self.0 +impl From<FileSerdeWrapper> for File { + fn from(f: FileSerdeWrapper) -> File { + f.0 } } diff --git a/sys_util/src/linux/syslog.rs b/sys_util/src/linux/syslog.rs index 179e2bf53..1ec876304 100644 --- a/sys_util/src/linux/syslog.rs +++ b/sys_util/src/linux/syslog.rs @@ -148,7 +148,7 @@ fn send_buf(socket: &UnixDatagram, buf: &[u8]) { const SEND_RETRY: usize = 2; for _ in 0..SEND_RETRY { - match socket.send(&buf[..]) { + match socket.send(buf) { Ok(_) => break, Err(e) => match e.kind() { ErrorKind::ConnectionRefused diff --git a/sys_util/src/mmap.rs b/sys_util/src/mmap.rs index 9da904948..75aee5c85 100644 --- a/sys_util/src/mmap.rs +++ b/sys_util/src/mmap.rs @@ -108,9 +108,9 @@ impl From<c_int> for Protection { } } -impl Into<c_int> for Protection { - fn into(self) -> c_int { - self.0 +impl From<Protection> for c_int { + fn from(p: Protection) -> c_int { + p.0 } } diff --git a/sys_util/src/shm.rs b/sys_util/src/shm.rs index 1937c92cc..0fdbf9f95 100644 --- a/sys_util/src/shm.rs +++ b/sys_util/src/shm.rs @@ -276,9 +276,9 @@ impl IntoRawFd for SharedMemory { } } -impl Into<File> for SharedMemory { - fn into(self) -> File { - self.fd +impl From<SharedMemory> for File { + fn from(s: SharedMemory) -> File { + s.fd } } |