chore: fix clippy warnings

This commit is contained in:
Alain Zscheile 2023-01-13 17:28:34 +01:00
parent afaa250026
commit 75dc9eb554

View file

@ -34,19 +34,19 @@ enum Command {
fn typ_to_txt(typ: u32) -> String {
use yglnk_core::IntEnum;
match yglnk_core::Type::from_int(typ) {
Ok(x) => format!("{:?}", x),
Err(_) => format!("{:08x}", typ),
Ok(x) => format!("{x:?}"),
Err(_) => format!("{typ:08x}"),
}
}
fn name_to_txt(name: &[u8]) -> String {
if let Ok(name) = core::str::from_utf8(name) {
format!("{:?}", name)
format!("{name:?}")
} else {
"0x".chars()
.chain(
name.iter()
.flat_map(|i| format!("{:02x}", i).chars().collect::<Vec<_>>()),
.flat_map(|i| format!("{i:02x}").chars().collect::<Vec<_>>()),
)
.collect()
}