From: Jason Ish Date: Wed, 5 Oct 2022 15:02:39 +0000 (-0600) Subject: rust: fix clippy lints for clippy::map_flatten X-Git-Tag: suricata-7.0.0-beta1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ba0a67143460d8f1cdce7ea53370a02d76259b4;p=thirdparty%2Fsuricata.git rust: fix clippy lints for clippy::map_flatten --- diff --git a/rust/src/common.rs b/rust/src/common.rs index 7c2e4f5d4d..a8880b2c4c 100644 --- a/rust/src/common.rs +++ b/rust/src/common.rs @@ -106,13 +106,12 @@ pub unsafe extern "C" fn rs_cstring_free(s: *mut c_char) { pub fn to_hex(input: &[u8]) -> String { return input .iter() - .map(|b| { + .flat_map(|b| { vec![ char::from(HEX[(b >> 4) as usize]), char::from(HEX[(b & 0xf) as usize]), ] }) - .flatten() .collect(); }