enable clippy pedantic for nova-stats, fix all warnings
This commit is contained in:
parent
64d0172bee
commit
e30cae5c7f
5 changed files with 15 additions and 17 deletions
|
|
@ -15,9 +15,8 @@ pub fn read_thermal_devices() -> Vec<ThermalDevice> {
|
|||
let temp_path = format!("/sys/class/thermal/thermal_zone{i}/temp");
|
||||
let type_path = format!("/sys/class/thermal/thermal_zone{i}/type");
|
||||
|
||||
let temp_str = match fs::read_to_string(&temp_path) {
|
||||
Ok(s) => s,
|
||||
Err(_) => break,
|
||||
let Ok(temp_str) = fs::read_to_string(&temp_path) else {
|
||||
break;
|
||||
};
|
||||
|
||||
let millic: i32 = match temp_str.trim().parse() {
|
||||
|
|
@ -27,8 +26,7 @@ pub fn read_thermal_devices() -> Vec<ThermalDevice> {
|
|||
let celsius = millic / 1000;
|
||||
|
||||
let name = fs::read_to_string(&type_path)
|
||||
.map(|s| s.trim().to_string())
|
||||
.unwrap_or_else(|_| format!("zone{i}"));
|
||||
.map_or_else(|_| format!("zone{i}"), |s| s.trim().to_string());
|
||||
|
||||
// Keep the highest temp seen for each device type
|
||||
let entry = by_name.entry(name).or_insert(celsius);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue