mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
vmm: Fix clippy warnings for use of .clone()
warning: assigning the result of `Clone::clone()` may be inefficient --> vmm/src/device_manager.rs:4188:17 | 4188 | id = child_id.clone(); | ^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `id.clone_from(child_id)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones = note: `#[warn(clippy::assigning_clones)]` on by default Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
parent
2529ffd593
commit
521a0d1ade
@ -4185,7 +4185,7 @@ impl DeviceManager {
|
||||
if !pci_device_node.children.is_empty() {
|
||||
assert_eq!(pci_device_node.children.len(), 1);
|
||||
let child_id = &pci_device_node.children[0];
|
||||
id = child_id.clone();
|
||||
id.clone_from(child_id);
|
||||
}
|
||||
}
|
||||
for child in pci_device_node.children.iter() {
|
||||
|
@ -175,7 +175,7 @@ mod tests {
|
||||
|
||||
// Check get_mut()
|
||||
let node = device_tree.get_mut(&id).unwrap();
|
||||
node.id = id2.clone();
|
||||
node.id.clone_from(&id2);
|
||||
let node = device_tree.0.get(&id).unwrap();
|
||||
assert_eq!(node.id, id2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user