mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
clippy: Address the issue 'needless-collect'
error: avoid using `collect()` when not needed --> vmm/src/vm.rs:630:86 | 630 | let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.guest_numa_id).collect(); | ^^^^^^^ ... 664 | if !node_id_list.contains(&dest) { | ---------------------------- the iterator could be used here instead | = note: `-D clippy::needless-collect` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
5825ab2dd4
commit
c4be0f4235
@ -624,8 +624,6 @@ impl Vm {
|
||||
let mut numa_nodes = BTreeMap::new();
|
||||
|
||||
if let Some(configs) = &configs {
|
||||
let node_id_list: Vec<u32> = configs.iter().map(|cfg| cfg.guest_numa_id).collect();
|
||||
|
||||
for config in configs.iter() {
|
||||
if numa_nodes.contains_key(&config.guest_numa_id) {
|
||||
error!("Can't define twice the same NUMA node");
|
||||
@ -658,7 +656,7 @@ impl Vm {
|
||||
let dest = distance.destination;
|
||||
let dist = distance.distance;
|
||||
|
||||
if !node_id_list.contains(&dest) {
|
||||
if !configs.iter().any(|cfg| cfg.guest_numa_id == dest) {
|
||||
error!("Unknown destination NUMA node {}", dest);
|
||||
return Err(Error::InvalidNumaConfig);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user