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:
parent
36807f66c4
commit
45b6672c64
1 changed files with 8 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue