From: Jason Ish Date: Mon, 28 Nov 2022 17:31:22 +0000 (-0600) Subject: rust/clippy: fix lint: while_let_loop X-Git-Tag: suricata-7.0.0-rc1~297 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=925bc74c1fb21217ec7c8e84394fce235252a3ea;p=thirdparty%2Fsuricata.git rust/clippy: fix lint: while_let_loop --- diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 346bbe8cfe..a0f00facc0 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -50,7 +50,6 @@ #![allow(clippy::single_match)] #![allow(clippy::type_complexity)] #![allow(clippy::upper_case_acronyms)] -#![allow(clippy::while_let_loop)] #[macro_use] extern crate bitflags; diff --git a/rust/src/rdp/util.rs b/rust/src/rdp/util.rs index d58ac94595..a4228f2037 100644 --- a/rust/src/rdp/util.rs +++ b/rust/src/rdp/util.rs @@ -28,16 +28,11 @@ use widestring::U16CString; pub fn le_slice_to_string(input: &[u8]) -> Result> { let mut vec = Vec::new(); let mut cursor = Cursor::new(input); - loop { - match cursor.read_u16::() { - Ok(x) => { - if x == 0 { - break; - }; - vec.push(x) - } - Err(_) => break, + while let Ok(x) = cursor.read_u16::() { + if x == 0 { + break; } + vec.push(x); } match U16CString::new(vec) { Ok(x) => match x.to_string() {