]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix assertions_on_constants for assert!(true)
authorPhilippe Antoine <pantoine@oisf.net>
Thu, 4 Jan 2024 10:48:32 +0000 (11:48 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 15 Jan 2024 16:49:12 +0000 (17:49 +0100)
Which will be optimized away by the compiler

rust/src/tftp/tftp.rs

index 1b093fed256d52eae0a7f0f9a55fba9f12f74c89..8797e4ea1372faf52edb8ca6ca7c6f701bfdc1be 100644 (file)
@@ -225,14 +225,8 @@ mod test {
             tx_data: AppLayerTxData::new(),
         };
 
-        match parse_tftp_request(&READ_REQUEST[..]) {
-            Some(txp) => {
-                assert_eq!(tx, txp);
-            }
-            None => {
-                assert!(true);
-            }
-        }
+        let txp = parse_tftp_request(&READ_REQUEST[..]).unwrap();
+        assert_eq!(tx, txp);
     }
 
     #[test]
@@ -245,14 +239,8 @@ mod test {
             tx_data: AppLayerTxData::new(),
         };
 
-        match parse_tftp_request(&WRITE_REQUEST[..]) {
-            Some(txp) => {
-                assert_eq!(tx, txp);
-            }
-            None => {
-                assert!(true, "fadfasd");
-            }
-        }
+        let txp = parse_tftp_request(&WRITE_REQUEST[..]).unwrap();
+        assert_eq!(tx, txp);
     }
 
     // Invalid request: filename not terminated