pscand-core: apply clippy fixes
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I5ea79528ee778af447cde4c82b0a7e5c6a6a6964
This commit is contained in:
parent
2fe05c6466
commit
b68503d320
1 changed files with 15 additions and 12 deletions
|
|
@ -49,28 +49,31 @@ impl SensorHelper {
|
|||
let id = filename
|
||||
.trim_start_matches("temp")
|
||||
.trim_end_matches("_input");
|
||||
if let Ok(temp) = Self::read_hwmon_sensor(hwmon_path, &filename) {
|
||||
if let Some(t) = temp {
|
||||
info.insert(format!("temp_{}_celsius", id), format!("{}", t / 1000.0));
|
||||
}
|
||||
if let Some(t) = Self::read_hwmon_sensor(hwmon_path, &filename)
|
||||
.ok()
|
||||
.flatten()
|
||||
{
|
||||
info.insert(format!("temp_{}_celsius", id), format!("{}", t / 1000.0));
|
||||
}
|
||||
}
|
||||
if filename.starts_with("fan") && filename.ends_with("_input") {
|
||||
let id = filename
|
||||
.trim_start_matches("fan")
|
||||
.trim_end_matches("_input");
|
||||
if let Ok(fan) = Self::read_hwmon_sensor(hwmon_path, &filename) {
|
||||
if let Some(f) = fan {
|
||||
info.insert(format!("fan_{}_rpm", id), format!("{}", f));
|
||||
}
|
||||
if let Some(f) = Self::read_hwmon_sensor(hwmon_path, &filename)
|
||||
.ok()
|
||||
.flatten()
|
||||
{
|
||||
info.insert(format!("fan_{}_rpm", id), format!("{}", f));
|
||||
}
|
||||
}
|
||||
if filename.starts_with("in") && filename.ends_with("_input") {
|
||||
let id = filename.trim_start_matches("in").trim_end_matches("_input");
|
||||
if let Ok(voltage) = Self::read_hwmon_sensor(hwmon_path, &filename) {
|
||||
if let Some(v) = voltage {
|
||||
info.insert(format!("voltage_{}_mv", id), format!("{}", v / 1000.0));
|
||||
}
|
||||
if let Some(v) = Self::read_hwmon_sensor(hwmon_path, &filename)
|
||||
.ok()
|
||||
.flatten()
|
||||
{
|
||||
info.insert(format!("voltage_{}_mv", id), format!("{}", v / 1000.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue