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
```
  • Loading branch information
zeenix committed Mar 13, 2024
1 parent 8b78982 commit 2846f0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion varlink-cli/src/watchclose_epoll.rs
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 2846f0f

Please sign in to comment.