From 82c4079fd016e340abe025ae71ef4e7624f9342a Mon Sep 17 00:00:00 2001 From: Christophe de Dinechin Date: Mon, 25 Mar 2024 16:56:41 +0100 Subject: [PATCH] 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: #9342 Signed-off-by: Christophe de Dinechin --- src/agent/src/signal.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/agent/src/signal.rs b/src/agent/src/signal.rs index 62a2193719..f5c3ced91f 100644 --- a/src/agent/src/signal.rs +++ b/src/agent/src/signal.rs @@ -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"); } } }