]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust/clippy: fix lint: while_let_loop
authorJason Ish <jason.ish@oisf.net>
Mon, 28 Nov 2022 17:31:22 +0000 (11:31 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 6 Dec 2022 13:10:10 +0000 (14:10 +0100)
rust/src/lib.rs
rust/src/rdp/util.rs

index 346bbe8cfed57b004dc2415807f1f6ad70a73a54..a0f00facc0bd0e9f204a81c54d159dcef64746f3 100644 (file)
@@ -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;
index d58ac94595a3bd73992814805bf1e34131e6947b..a4228f20373b23df9c8495f2bc5f1eac6a43475f 100644 (file)
@@ -28,16 +28,11 @@ use widestring::U16CString;
 pub fn le_slice_to_string(input: &[u8]) -> Result<String, Box<dyn std::error::Error>> {
     let mut vec = Vec::new();
     let mut cursor = Cursor::new(input);
-    loop {
-        match cursor.read_u16::<byteorder::LittleEndian>() {
-            Ok(x) => {
-                if x == 0 {
-                    break;
-                };
-                vec.push(x)
-            }
-            Err(_) => break,
+    while let Ok(x) = cursor.read_u16::<byteorder::LittleEndian>() {
+        if x == 0 {
+            break;
         }
+        vec.push(x);
     }
     match U16CString::new(vec) {
         Ok(x) => match x.to_string() {