From c49463c86f4c54f3bd322eaead07ce9a2c0b1d56 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 4 Jan 2024 11:48:32 +0100 Subject: [PATCH] rust: fix assertions_on_constants for assert!(true) Which will be optimized away by the compiler --- rust/src/tftp/tftp.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) 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