map + flatten to flat_map

This commit is contained in:
rumcajs 2019-02-05 09:46:52 +01:00
parent c2ee4c63f5
commit df760c57fe

View File

@ -83,8 +83,7 @@ impl WolPacket {
/// Panics when input MAC is invalid (i.e. contains non-byte characters)
fn mac_to_byte(data: &str, sep: char) -> Vec<u8> {
data.split(sep)
.map(|x| hex::decode(x).expect("Invalid mac!"))
.flatten()
.flat_map(|x| hex::decode(x).expect("Invalid mac!"))
.collect()
}