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
|
|
@ -53,7 +53,7 @@ fn find_amd_hwmon() -> Option<String> {
|
|||
None
|
||||
}
|
||||
|
||||
fn read_amd(card: &str, hwmon: &Option<String>) -> Option<GpuInfo> {
|
||||
fn read_amd(card: &str, hwmon: Option<&String>) -> Option<GpuInfo> {
|
||||
let usage: u32 = fs::read_to_string(format!("{card}/gpu_busy_percent"))
|
||||
.ok()?
|
||||
.trim()
|
||||
|
|
@ -70,11 +70,9 @@ fn read_amd(card: &str, hwmon: &Option<String>) -> Option<GpuInfo> {
|
|||
.parse()
|
||||
.ok()?;
|
||||
let temp_c = hwmon
|
||||
.as_ref()
|
||||
.and_then(|h| fs::read_to_string(format!("{h}/temp1_input")).ok())
|
||||
.and_then(|s| s.trim().parse::<i32>().ok())
|
||||
.map(|mc| mc / 1000)
|
||||
.unwrap_or(0);
|
||||
.map_or(0, |mc| mc / 1000);
|
||||
Some(GpuInfo {
|
||||
usage,
|
||||
vram_used_gb: vram_used as f64 / 1_073_741_824.0,
|
||||
|
|
@ -114,7 +112,7 @@ pub fn emit_gpu(out: &mut impl Write, backend: &GpuBackend) {
|
|||
GpuBackend::Amd {
|
||||
card_path,
|
||||
hwmon_path,
|
||||
} => read_amd(card_path, hwmon_path),
|
||||
} => read_amd(card_path, hwmon_path.as_ref()),
|
||||
GpuBackend::Nvidia => read_nvidia(),
|
||||
GpuBackend::None => return,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue