From 2529ffd593acd65b2a62483c388f5a469ed6848e Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 19 Mar 2024 16:34:40 +0000 Subject: [PATCH] virtio-devices: Fix clippy warning for use of .clone() warning: `devices` (lib) generated 1 warning (run `cargo clippy --fix --lib -p devices` to apply 1 suggestion) warning: assigning the result of `Clone::clone()` may be inefficient --> virtio-devices/src/transport/pci_device.rs:1073:9 | 1073 | self.bar_regions = bars.clone(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.bar_regions.clone_from(&bars)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones Signed-off-by: Rob Bradford --- virtio-devices/src/transport/pci_device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtio-devices/src/transport/pci_device.rs b/virtio-devices/src/transport/pci_device.rs index 5afc81bf5..931d722d5 100644 --- a/virtio-devices/src/transport/pci_device.rs +++ b/virtio-devices/src/transport/pci_device.rs @@ -1070,7 +1070,7 @@ impl PciDevice for VirtioPciDevice { bars.push(bar); } - self.bar_regions = bars.clone(); + self.bar_regions.clone_from(&bars); Ok(bars) }