Skip to content

Commit

Permalink
varlink-cli: Drup unneeded Vec creation
Browse files Browse the repository at this point in the history
Fixes clippy warning:

```rust
warning: useless use of `vec!`
   --> varlink-cli/src/watchclose_epoll.rs:157:21
    |
157 |         let mut v = vec![Event { events: 0, data: 0 }, Event { events: 0, data: 1 }];
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `[Event { events: 0, data: 0 }, Event { events: 0, data: 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: Zeeshan Ali Khan <[email protected]>
  • Loading branch information
zeenix committed Mar 14, 2024
1 parent 149b32c commit 1ea9638
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion varlink-cli/src/watchclose_epoll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl WatchClose {

impl Read for WatchClose {
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
let mut v = vec![Event { events: 0, data: 0 }, Event { events: 0, data: 1 }];
let mut v = [Event { events: 0, data: 0 }, Event { events: 0, data: 1 }];

'outer: loop {
let r = epoll_wait(self.efd, -1, &mut v[..])?;
Expand Down

0 comments on commit 1ea9638

Please sign in to comment.