1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-07 16:07:37 +00:00

agent: Remove useless loop

This is the report from `make check`:

```
error: this loop never actually loops
   --> src/signal.rs:147:9
    |
147 | /         loop {
148 | |             select! {
149 | |                 _ = handle => {
150 | |                     println!("INFO: task completed");
...   |
156 | |             }
157 | |         }
    | |_________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
    = note: `#[deny(clippy::never_loop)]` on by default
```

There is only one option: you get something or a timeout. You never retry, so
the report is correct.

Fixes: 

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
This commit is contained in:
Christophe de Dinechin 2024-03-25 16:56:41 +01:00
parent df5c88cdf0
commit 82c4079fd0

View File

@ -144,15 +144,12 @@ mod tests {
tx.send(true).expect("failed to request shutdown");
loop {
select! {
_ = handle => {
println!("INFO: task completed");
break;
},
_ = &mut timeout => {
panic!("signal thread failed to stop");
}
select! {
_ = handle => {
println!("INFO: task completed");
},
_ = &mut timeout => {
panic!("signal thread failed to stop");
}
}
}