fixed returns

This commit is contained in:
2025-08-09 12:47:50 +02:00
parent 2e4d17f964
commit 2b9e1eccb5
3 changed files with 8 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ pub async fn get_cpu_temp() -> Result<f64, Box<dyn Error>> {
.and_then(|s| s.split_whitespace().next())
{
if let Ok(temp) = temp_str.replace("°C", "").parse::<f32>() {
return Ok(temp);
return Ok(temp.into());
}
}
}
@@ -63,7 +63,7 @@ pub async fn get_cpu_temp() -> Result<f64, Box<dyn Error>> {
// 2. Sysfs (Intel/AMD)
if let Ok(content) = fs::read_to_string("/sys/class/thermal/thermal_zone0/temp") {
if let Ok(temp) = content.trim().parse::<f32>() {
return Ok(temp / 1000.0);
return Ok((temp / 1000.0).into());
}
}
@@ -78,7 +78,7 @@ pub async fn get_cpu_temp() -> Result<f64, Box<dyn Error>> {
for path in paths.flatten() {
if let Ok(content) = fs::read_to_string(&path) {
if let Ok(temp) = content.trim().parse::<f32>() {
return Ok(temp / 1000.0);
return Ok((temp / 1000.0).into());
}
}
}