From: Philippe Antoine Date: Thu, 4 Jan 2024 10:48:32 +0000 (+0100) Subject: rust: fix assertions_on_constants for assert!(true) X-Git-Tag: suricata-7.0.9~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57111f35c3d515370be074b8d1da460efad1818f;p=thirdparty%2Fsuricata.git rust: fix assertions_on_constants for assert!(true) Which will be optimized away by the compiler (cherry picked from commit c49463c86f4c54f3bd322eaead07ce9a2c0b1d56) --- diff --git a/rust/src/tftp/tftp.rs b/rust/src/tftp/tftp.rs index 1b093fed25..8797e4ea13 100644 --- a/rust/src/tftp/tftp.rs +++ b/rust/src/tftp/tftp.rs @@ -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