Refactor device reset logic to use match statement for better clarity
All checks were successful
/ release (nightly) (push) Successful in 1m55s
All checks were successful
/ release (nightly) (push) Successful in 1m55s
This commit is contained in:
parent
28ffb56665
commit
8209da3b21
2 changed files with 4 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "phenix"
|
name = "phenix"
|
||||||
description = "Utility to restart PCIe devices when link is lost."
|
description = "Utility to restart PCIe devices when link is lost."
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
repository="https://code.edgarpierre.fr/edpibu/phenix"
|
repository="https://code.edgarpierre.fr/edpibu/phenix"
|
||||||
|
|
|
@ -23,8 +23,9 @@ fn manage_line(line: String) {
|
||||||
println!("PCIe link lost {prefix}");
|
println!("PCIe link lost {prefix}");
|
||||||
|
|
||||||
let id = line.splitn(3, " ").nth(1);
|
let id = line.splitn(3, " ").nth(1);
|
||||||
if let Some(id) = id {
|
match id {
|
||||||
reset_device(id);
|
Some(id) => reset_device(id),
|
||||||
|
None => println!("No device id found in message {line}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue