From 5bbbf610828e975fd308b90543359a85ef59b67f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 1 Dec 2018 17:49:30 -0800 Subject: lint: Resolve the easier clippy lints Hopefully the changes are self-explanatory and uncontroversial. This eliminates much of the noise from `cargo clippy` and, for my purposes, gives me a reasonable way to use it as a tool when writing and reviewing code. Here is the Clippy invocation I was using: cargo +nightly clippy -- -W clippy::correctness -A renamed_and_removed_lints -Aclippy::{blacklisted_name,borrowed_box,cast_lossless,cast_ptr_alignment,enum_variant_names,identity_op,if_same_then_else,mut_from_ref,needless_pass_by_value,new_without_default,new_without_default_derive,or_fun_call,ptr_arg,should_implement_trait,single_match,too_many_arguments,trivially_copy_pass_by_ref,unreadable_literal,unsafe_vector_initialization,useless_transmute} TEST=cargo check --features wl-dmabuf,gpu,usb-emulation TEST=boot linux Change-Id: I55eb1b4a72beb2f762480e3333a921909314a0a2 Reviewed-on: https://chromium-review.googlesource.com/1356911 Commit-Ready: David Tolnay Tested-by: David Tolnay Reviewed-by: Dylan Reid --- vm_control/src/lib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'vm_control/src') diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index deec07d..ab9af1d 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -41,8 +41,8 @@ pub enum MaybeOwnedFd { impl AsRawFd for MaybeOwnedFd { fn as_raw_fd(&self) -> RawFd { match self { - &MaybeOwnedFd::Owned(ref f) => f.as_raw_fd(), - &MaybeOwnedFd::Borrowed(fd) => fd, + MaybeOwnedFd::Owned(f) => f.as_raw_fd(), + MaybeOwnedFd::Borrowed(fd) => *fd, } } } @@ -135,32 +135,32 @@ impl VmRequest { balloon_host_socket: &UnixDatagram, ) -> VmResponse { *running = true; - match self { - &VmRequest::Exit => { + match *self { + VmRequest::Exit => { *running = false; VmResponse::Ok } - &VmRequest::RegisterIoevent(ref evt, addr, datamatch) => { + VmRequest::RegisterIoevent(ref evt, addr, datamatch) => { match vm.register_ioevent(evt, addr, Datamatch::U32(Some(datamatch))) { Ok(_) => VmResponse::Ok, Err(e) => VmResponse::Err(e), } } - &VmRequest::RegisterIrqfd(ref evt, irq) => match vm.register_irqfd(evt, irq) { + VmRequest::RegisterIrqfd(ref evt, irq) => match vm.register_irqfd(evt, irq) { Ok(_) => VmResponse::Ok, - Err(e) => return VmResponse::Err(e), + Err(e) => VmResponse::Err(e), }, - &VmRequest::RegisterMemory(ref fd, size) => { + VmRequest::RegisterMemory(ref fd, size) => { match register_memory(vm, sys_allocator, fd, size) { Ok((pfn, slot)) => VmResponse::RegisterMemory { pfn, slot }, Err(e) => VmResponse::Err(e), } } - &VmRequest::UnregisterMemory(slot) => match vm.remove_device_memory(slot) { + VmRequest::UnregisterMemory(slot) => match vm.remove_device_memory(slot) { Ok(_) => VmResponse::Ok, Err(e) => VmResponse::Err(e), }, - &VmRequest::BalloonAdjust(num_pages) => { + VmRequest::BalloonAdjust(num_pages) => { let mut buf = [0u8; 4]; // write_i32 can't fail as the buffer is 4 bytes long. (&mut buf[0..]) @@ -171,7 +171,7 @@ impl VmRequest { Err(_) => VmResponse::Err(SysError::last()), } } - &VmRequest::AllocateAndRegisterGpuMemory { + VmRequest::AllocateAndRegisterGpuMemory { width, height, format, -- cgit 1.4.1