map + flatten to flat_map
This commit is contained in:
parent
c2ee4c63f5
commit
df760c57fe
|
@ -83,8 +83,7 @@ impl WolPacket {
|
||||||
/// Panics when input MAC is invalid (i.e. contains non-byte characters)
|
/// Panics when input MAC is invalid (i.e. contains non-byte characters)
|
||||||
fn mac_to_byte(data: &str, sep: char) -> Vec<u8> {
|
fn mac_to_byte(data: &str, sep: char) -> Vec<u8> {
|
||||||
data.split(sep)
|
data.split(sep)
|
||||||
.map(|x| hex::decode(x).expect("Invalid mac!"))
|
.flat_map(|x| hex::decode(x).expect("Invalid mac!"))
|
||||||
.flatten()
|
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user