misc: clippy: add if_not_else

This removes cognitive load when reading if statements.
All changes were applied by clippy via `--fix`.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-11-21 11:08:27 +01:00
committed by Rob Bradford
parent a0b72dce22
commit 0a07c96d17
16 changed files with 139 additions and 144 deletions

View File

@@ -757,12 +757,11 @@ pub fn ssh_command_ip(
pub fn exec_host_command_with_retries(command: &str, retries: u32, interval: Duration) -> bool {
for _ in 0..retries {
let s = exec_host_command_output(command).status;
if !s.success() {
eprintln!("\n\n==== retrying in {interval:?} ===\n\n");
thread::sleep(interval);
} else {
if s.success() {
return true;
}
eprintln!("\n\n==== retrying in {interval:?} ===\n\n");
thread::sleep(interval);
}
false
@@ -1686,17 +1685,17 @@ pub fn measure_virtio_net_throughput(
failed = true;
}
if !failed {
// Safe to unwrap as we know the child has terminated successfully
let output = c.wait_with_output().unwrap();
results.push(parse_iperf3_output(&output.stdout, receive, bandwidth)?);
} else {
if failed {
let _ = c.kill();
let output = c.wait_with_output().unwrap();
println!(
"=============== Client output [Error] ===============\n\n{}\n\n===========end============\n\n",
String::from_utf8_lossy(&output.stdout)
);
} else {
// Safe to unwrap as we know the child has terminated successfully
let output = c.wait_with_output().unwrap();
results.push(parse_iperf3_output(&output.stdout, receive, bandwidth)?);
}
}