summary refs log tree commit diff
path: root/devices/src/usb
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@chromium.org>2019-04-12 18:32:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-17 17:22:49 -0700
commit3fbeda1d08b516478a6e7c88dabd24a251c11f35 (patch)
tree58ce246e3a4a3027b18e85b66d53e35cf8644911 /devices/src/usb
parent2da9b8181f357d05b839cfb31d6288e1266c70f6 (diff)
downloadcrosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar.gz
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar.bz2
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar.lz
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar.xz
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.tar.zst
crosvm-3fbeda1d08b516478a6e7c88dabd24a251c11f35.zip
clippy: Resolve clone_on_copy
TEST=bin/clippy

Change-Id: Ia9f58fd7ba0b7af6eee455f52b3b9004547aa25e
Reviewed-on: https://chromium-review.googlesource.com/1566659
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Diffstat (limited to 'devices/src/usb')
-rw-r--r--devices/src/usb/xhci/device_slot.rs4
-rw-r--r--devices/src/usb/xhci/event_ring.rs8
-rw-r--r--devices/src/usb/xhci/ring_buffer.rs2
3 files changed, 6 insertions, 8 deletions
diff --git a/devices/src/usb/xhci/device_slot.rs b/devices/src/usb/xhci/device_slot.rs
index 129c849..5f82d4a 100644
--- a/devices/src/usb/xhci/device_slot.rs
+++ b/devices/src/usb/xhci/device_slot.rs
@@ -743,7 +743,7 @@ impl DeviceSlot {
                     .checked_add(
                         (device_context_index as u64 + 1) * DEVICE_CONTEXT_ENTRY_SIZE as u64,
                     )
-                    .ok_or(Error::BadInputContextAddr(input_context_ptr.clone()))?,
+                    .ok_or(Error::BadInputContextAddr(input_context_ptr))?,
             )
             .map_err(Error::ReadGuestMemory)?;
         usb_debug!("context being copied {:?}", ctx);
@@ -753,7 +753,7 @@ impl DeviceSlot {
                 ctx,
                 device_context_ptr
                     .checked_add(device_context_index as u64 * DEVICE_CONTEXT_ENTRY_SIZE as u64)
-                    .ok_or(Error::BadDeviceContextAddr(device_context_ptr.clone()))?,
+                    .ok_or(Error::BadDeviceContextAddr(device_context_ptr))?,
             )
             .map_err(Error::WriteGuestMemory)
     }
diff --git a/devices/src/usb/xhci/event_ring.rs b/devices/src/usb/xhci/event_ring.rs
index b2c51d1..0b35ef7 100644
--- a/devices/src/usb/xhci/event_ring.rs
+++ b/devices/src/usb/xhci/event_ring.rs
@@ -98,7 +98,7 @@ impl EventRing {
             let address = self.enqueue_pointer;
             let address = address
                 .checked_add(CYCLE_STATE_OFFSET as u64)
-                .ok_or(Error::BadEnqueuePointer(self.enqueue_pointer.clone()))?;
+                .ok_or(Error::BadEnqueuePointer(self.enqueue_pointer))?;
             self.mem
                 .write_all_at_addr(cycle_bit_dword, address)
                 .map_err(Error::MemoryWrite)?;
@@ -112,7 +112,7 @@ impl EventRing {
         );
         self.enqueue_pointer = match self.enqueue_pointer.checked_add(size_of::<Trb>() as u64) {
             Some(addr) => addr,
-            None => return Err(Error::BadEnqueuePointer(self.enqueue_pointer.clone())),
+            None => return Err(Error::BadEnqueuePointer(self.enqueue_pointer)),
         };
         self.trb_count -= 1;
         if self.trb_count == 0 {
@@ -214,9 +214,7 @@ impl EventRing {
         }
         self.segment_table_base_address
             .checked_add(((size_of::<EventRingSegmentTableEntry>() as u16) * index) as u64)
-            .ok_or(Error::BadSegTableAddress(
-                self.segment_table_base_address.clone(),
-            ))
+            .ok_or(Error::BadSegTableAddress(self.segment_table_base_address))
     }
 }
 
diff --git a/devices/src/usb/xhci/ring_buffer.rs b/devices/src/usb/xhci/ring_buffer.rs
index 1eee3e2..2f66fa8 100644
--- a/devices/src/usb/xhci/ring_buffer.rs
+++ b/devices/src/usb/xhci/ring_buffer.rs
@@ -84,7 +84,7 @@ impl RingBuffer {
             self.dequeue_pointer = match self.dequeue_pointer.checked_add(size_of::<Trb>() as u64) {
                 Some(addr) => addr,
                 None => {
-                    return Err(Error::BadDequeuePointer(self.dequeue_pointer.clone()));
+                    return Err(Error::BadDequeuePointer(self.dequeue_pointer));
                 }
             };