diff --git a/src/app/data_harvester/temperature/linux.rs b/src/app/data_harvester/temperature/linux.rs index 8e5f7674..c3f250ec 100644 --- a/src/app/data_harvester/temperature/linux.rs +++ b/src/app/data_harvester/temperature/linux.rs @@ -11,8 +11,9 @@ use crate::app::{ }; /// Get temperature sensors from the linux sysfs interface `/sys/class/hwmon`. -/// See [here](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-hwmon) for -/// details. +/// +/// See [the Linux kernel documentation](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-hwmon) +/// for more details. /// /// This method will return `0` as the temperature for devices, such as GPUs, /// that support power management features and power themselves off. @@ -191,8 +192,10 @@ fn get_from_hwmon( } /// Gets data from `/sys/class/thermal/thermal_zone*`. This should only be used if -/// [`get_from_hwmon`] doesn't return anything. See -/// [here](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-thermal) for details. +/// [`get_from_hwmon`] doesn't return anything. +/// +/// See [the Linux kernel documentation](https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-thermal) +/// for more details. fn get_from_thermal_zone( temp_type: &TemperatureType, filter: &Option, ) -> Result> { @@ -238,11 +241,12 @@ fn get_from_thermal_zone( pub fn get_temperature_data( temp_type: &TemperatureType, filter: &Option, ) -> Result>> { - let mut temperature_vec: Vec = get_from_hwmon(temp_type, filter)?; + let mut temperature_vec: Vec = + get_from_hwmon(temp_type, filter).unwrap_or_default(); if temperature_vec.is_empty() { - // If it's empty, fall back to checking `thermal_zone*`. - temperature_vec = get_from_thermal_zone(temp_type, filter)?; + // If it's empty, try to fall back to checking `thermal_zone*`. + temperature_vec = get_from_thermal_zone(temp_type, filter).unwrap_or_default(); } #[cfg(feature = "nvidia")]