mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Address Rust 1.51.0 clippy issue (vec_init_then_push)
warning: calls to `push` immediately after creation
--> virtio-devices/src/vhost_user/net.rs:291:13
|
291 | / let mut interrupt_list_sub: Vec<(Option<EventFd>, Queue)> = Vec::with_capacity(2);
292 | | interrupt_list_sub.push(vu_interrupt_list.remove(0));
293 | | interrupt_list_sub.push(vu_interrupt_list.remove(0));
| |_________________________________________________________________^ help: consider using the `vec![]` macro: `let mut interrupt_list_sub: Vec<(Option<EventFd>, Queue)> = vec![..];`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -231,8 +231,7 @@ impl VirtioDevice for Blk {
|
||||
|
||||
let mut epoll_threads = Vec::new();
|
||||
for i in 0..vu_interrupt_list.len() {
|
||||
let mut interrupt_list_sub: Vec<(Option<EventFd>, Queue)> = Vec::with_capacity(1);
|
||||
interrupt_list_sub.push(vu_interrupt_list.remove(0));
|
||||
let interrupt_list_sub = vec![vu_interrupt_list.remove(0)];
|
||||
|
||||
let kill_evt = self
|
||||
.common
|
||||
|
||||
@@ -288,9 +288,7 @@ impl VirtioDevice for Net {
|
||||
|
||||
let mut epoll_threads = Vec::new();
|
||||
for i in 0..vu_interrupt_list.len() / 2 {
|
||||
let mut interrupt_list_sub: Vec<(Option<EventFd>, Queue)> = Vec::with_capacity(2);
|
||||
interrupt_list_sub.push(vu_interrupt_list.remove(0));
|
||||
interrupt_list_sub.push(vu_interrupt_list.remove(0));
|
||||
let interrupt_list_sub = vec![vu_interrupt_list.remove(0), vu_interrupt_list.remove(0)];
|
||||
|
||||
let kill_evt = self
|
||||
.common
|
||||
|
||||
Reference in New Issue
Block a user