build: Fix beta clippy issue (useless_vec)

warning: useless use of `vec!`
   --> test_infra/src/lib.rs:111:30
    |
111 |             let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); 1];
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[epoll::Event::new(epoll::Events::empty(), 0); 1]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec
    = note: `#[warn(clippy::useless_vec)]` on by default

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
This commit is contained in:
Yu Li
2023-07-12 12:25:25 +08:00
committed by Bo Chen
parent aac614e2ec
commit d0dbc7fb4d
4 changed files with 18 additions and 20 deletions

View File

@@ -108,7 +108,7 @@ impl GuestNetworkConfig {
epoll::Event::new(epoll::Events::EPOLLIN, 0),
)
.expect("Cannot add 'tcp_listener' event to epoll");
let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); 1];
let mut events = [epoll::Event::new(epoll::Events::empty(), 0); 1];
loop {
let num_events = match epoll::wait(epoll_fd, timeout * 1000_i32, &mut events[..]) {
Ok(num_events) => Ok(num_events),
@@ -252,7 +252,7 @@ impl DiskConfig for UbuntuDiskConfig {
.join("ubuntu")
.join("ci");
vec!["meta-data"].iter().for_each(|x| {
["meta-data"].iter().for_each(|x| {
rate_limited_copy(source_file_dir.join(x), cloud_init_directory.join(x))
.expect("Expect copying cloud-init meta-data to succeed");
});
@@ -308,7 +308,7 @@ impl DiskConfig for UbuntuDiskConfig {
.output()
.expect("Expect creating disk image to succeed");
vec!["user-data", "meta-data", "network-config"]
["user-data", "meta-data", "network-config"]
.iter()
.for_each(|x| {
std::process::Command::new("mcopy")