Skip to content

Commit

Permalink
A few clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nokyan committed Jul 9, 2024
1 parent 786709f commit fde4e92
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/utils/battery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,8 @@ impl Battery {
String::from_utf8_lossy(
&s.as_ref()
.split_whitespace()
.map(|hex| u8::from_str_radix(&hex.replace("0x", ""), 16))
.flatten()
.map(|byte| if byte == 0x0 { ' ' as u8 } else { byte }) // gtk will crash when encountering NUL
.flat_map(|hex| u8::from_str_radix(&hex.replace("0x", ""), 16))
.map(|byte| if byte == 0x0 { b' ' } else { byte }) // gtk will crash when encountering NUL
.collect::<Vec<u8>>(),
)
.to_string()
Expand Down

0 comments on commit fde4e92

Please sign in to comment.