1
Fork 0
mirror of https://github.com/RGBCube/superfreq synced 2025-07-27 17:07:44 +00:00

battery: avoid manual flatten; capture each Err

This commit is contained in:
NotAShelf 2025-05-15 20:10:23 +03:00
parent 36807f66c4
commit 45b6672c64
No known key found for this signature in database
GPG key ID: 29D95B64378DB4BF

View file

@ -95,7 +95,14 @@ fn find_supported_batteries(power_supply_path: &Path) -> Result<Vec<SupportedBat
})?;
let mut supported_batteries = Vec::new();
for entry in entries.flatten() {
for entry in entries {
let entry = match entry {
Ok(e) => e,
Err(e) => {
warn!("Failed to read power-supply entry: {e}");
continue;
}
};
let ps_path = entry.path();
if is_battery(&ps_path)? {
if let Some(battery) = find_battery_with_threshold_support(&ps_path) {