]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: allow collapsible_else_if for debug logs
authorPhilippe Antoine <pantoine@oisf.net>
Fri, 27 Jun 2025 07:20:56 +0000 (09:20 +0200)
committerPhilippe Antoine <pantoine@oisf.net>
Fri, 27 Jun 2025 07:41:51 +0000 (09:41 +0200)
see https://github.com/rust-lang/rust-clippy/issues/15158

rust/src/smb/smb.rs
rust/src/smb/smb2_ioctl.rs
rust/src/ssh/ssh.rs

index 7ed84b66c2e2c5772d8d933d7b7780b788e3c019..c22bc9fc97b337254eef42f9241a5b215bb4a3c1 100644 (file)
@@ -1754,6 +1754,8 @@ impl SMBState {
                                         Ok((_, ref smb_record)) => {
                                             let pdu_frame = self.add_smb1_tc_pdu_frame(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64);
                                             self.add_smb1_tc_hdr_data_frames(flow, stream_slice, nbss_hdr.data, nbss_hdr.length as i64);
+                                            // see https://github.com/rust-lang/rust-clippy/issues/15158
+                                            #[allow(clippy::collapsible_else_if)]
                                             if smb_record.is_response() {
                                                 smb1_response_record(self, smb_record);
                                             } else {
@@ -1777,6 +1779,8 @@ impl SMBState {
                                                 let record_len = (nbss_data.len() - nbss_data_rem.len()) as i64;
                                                 let pdu_frame = self.add_smb2_tc_pdu_frame(flow, stream_slice, nbss_data, record_len);
                                                 self.add_smb2_tc_hdr_data_frames(flow, stream_slice, nbss_data, record_len, smb_record.header_len as i64);
+                                                // see https://github.com/rust-lang/rust-clippy/issues/15158
+                                                #[allow(clippy::collapsible_else_if)]
                                                 if smb_record.is_response() {
                                                     smb2_response_record(self, smb_record);
                                                 } else {
@@ -2043,6 +2047,8 @@ fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, be
             if smb.version == 0xff_u8 { // SMB1
                 SCLogDebug!("SMBv1 record");
                 if let Ok((_, ref smb_record)) = parse_smb_record(data) {
+                    // see https://github.com/rust-lang/rust-clippy/issues/15158
+                    #[allow(clippy::collapsible_else_if)]
                     if smb_record.flags & 0x80 != 0 {
                         SCLogDebug!("RESPONSE {:02x}", smb_record.flags);
                         if direction == Direction::ToServer {
@@ -2059,6 +2065,8 @@ fn smb_probe_tcp_midstream(direction: Direction, slice: &[u8], rdir: *mut u8, be
             } else if smb.version == 0xfe_u8 { // SMB2
                 SCLogDebug!("SMB2 record");
                 if let Ok((_, ref smb_record)) = parse_smb2_record_direction(data) {
+                    // see https://github.com/rust-lang/rust-clippy/issues/15158
+                    #[allow(clippy::collapsible_else_if)]
                     if direction == Direction::ToServer {
                         SCLogDebug!("direction Direction::ToServer smb_record {:?}", smb_record);
                         if !smb_record.request {
index 73687aa5568f31d6724b29b7ac46a6c521395e5f..ff85a5fefba0699bd475c59442a24bf3c908d476 100644 (file)
@@ -98,6 +98,8 @@ pub fn smb2_ioctl_response_record(state: &mut SMBState, r: &Smb2Record)
             } else {
                 false
             };
+            // see https://github.com/rust-lang/rust-clippy/issues/15158
+            #[allow(clippy::collapsible_else_if)]
             if is_dcerpc {
                 SCLogDebug!("IOCTL response data is_pipe. Calling smb_read_dcerpc_record");
                 let vercmd = SMBVerCmdStat::new2_with_ntstatus(SMB2_COMMAND_IOCTL, r.nt_status);
index 32526132ec10da4696fa65bbd6101cac94bdd5f1..9e27594df2d6a9de8c67ba9a578ce5ee22e10e50 100644 (file)
@@ -296,6 +296,8 @@ impl SSHState {
                 return r;
             }
             Err(Err::Incomplete(_)) => {
+                // see https://github.com/rust-lang/rust-clippy/issues/15158
+                #[allow(clippy::collapsible_else_if)]
                 if input.len() < SSH_MAX_BANNER_LEN {
                     //0 consumed, needs at least one more byte
                     return AppLayerResult::incomplete(0_u32, (input.len() + 1) as u32);