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 --- arch/src/lib.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'arch/src/lib.rs') diff --git a/arch/src/lib.rs b/arch/src/lib.rs index bd061fd..ee684d1 100644 --- a/arch/src/lib.rs +++ b/arch/src/lib.rs @@ -102,35 +102,33 @@ pub enum DeviceRegistrationError { impl fmt::Display for DeviceRegistrationError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { - &DeviceRegistrationError::AllocateIoAddrs(ref e) => { + DeviceRegistrationError::AllocateIoAddrs(e) => { write!(f, "Allocating IO addresses: {:?}", e) } - &DeviceRegistrationError::AllocateIrq => write!(f, "Allocating IRQ number"), - &DeviceRegistrationError::CreateMmioDevice(ref e) => { + DeviceRegistrationError::AllocateIrq => write!(f, "Allocating IRQ number"), + DeviceRegistrationError::CreateMmioDevice(e) => { write!(f, "failed to create mmio device: {:?}", e) } - &DeviceRegistrationError::Cmdline(ref e) => { + DeviceRegistrationError::Cmdline(e) => { write!(f, "unable to add device to kernel command line: {}", e) } - &DeviceRegistrationError::EventFdCreate(ref e) => { + DeviceRegistrationError::EventFdCreate(e) => { write!(f, "failed to create eventfd: {:?}", e) } - &DeviceRegistrationError::MmioInsert(ref e) => { + DeviceRegistrationError::MmioInsert(e) => { write!(f, "failed to add to mmio bus: {:?}", e) } - &DeviceRegistrationError::RegisterIoevent(ref e) => { + DeviceRegistrationError::RegisterIoevent(e) => { write!(f, "failed to register ioevent to VM: {:?}", e) } - &DeviceRegistrationError::RegisterIrqfd(ref e) => { + DeviceRegistrationError::RegisterIrqfd(e) => { write!(f, "failed to register irq eventfd to VM: {:?}", e) } - &DeviceRegistrationError::ProxyDeviceCreation(ref e) => { + DeviceRegistrationError::ProxyDeviceCreation(e) => { write!(f, "failed to create proxy device: {}", e) } - &DeviceRegistrationError::IrqsExhausted => write!(f, "no more IRQs are available"), - &DeviceRegistrationError::AddrsExhausted => { - write!(f, "no more addresses are available") - } + DeviceRegistrationError::IrqsExhausted => write!(f, "no more IRQs are available"), + DeviceRegistrationError::AddrsExhausted => write!(f, "no more addresses are available"), } } } -- cgit 1.4.1