]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix clippy warnings 9233/head
authorShivani Bhardwaj <shivani@oisf.net>
Thu, 13 Jul 2023 16:09:47 +0000 (21:39 +0530)
committerVictor Julien <vjulien@oisf.net>
Thu, 13 Jul 2023 20:17:04 +0000 (22:17 +0200)
rust/src/dcerpc/dcerpc.rs
rust/src/http2/http2.rs
rust/src/ike/ikev2.rs
rust/src/krb/detect.rs
rust/src/smb/smb.rs
rust/src/ssh/ssh.rs

index bd6488ad3fa9e6666d4414c091defecf146da11b..57f3d41f0f915cb9e72a3e4a7d5b4d092a3f58bc 100644 (file)
@@ -723,7 +723,7 @@ impl DCERPCState {
             Ok((leftover_bytes, mut back)) => {
                 if let Some(ref mut bind) = self.bind {
                     for (uuid_internal_id, r) in back.ctxitems.iter().enumerate() {
-                        for mut uuid in bind.uuid_list.iter_mut() {
+                        for uuid in bind.uuid_list.iter_mut() {
                             if uuid.internal_id == uuid_internal_id as u16 {
                                 uuid.result = r.ack_result;
                                 if uuid.result != 0 {
index 011000b5432b92b3a4f0912fe66d9a54650bc8d5..5939c97210fafb1e72685c9adacdfa88c2b83220 100644 (file)
@@ -969,7 +969,7 @@ impl HTTP2State {
                                 //borrow checker forbids to reuse directly tx
                                 let index = self.find_tx_index(sid);
                                 if index > 0 {
-                                    let mut tx_same = &mut self.transactions[index - 1];
+                                    let tx_same = &mut self.transactions[index - 1];
                                     if dir == Direction::ToServer {
                                         tx_same.ft_tc.tx_id = tx_same.tx_id - 1;
                                     } else {
index ecb54613da0678388f173c17d219fb22847ac49e..a1be25ffb4a2b3e626a93a48961561228cc31db1 100644 (file)
@@ -96,7 +96,7 @@ impl Default for Ikev2Container {
 }
 
 pub fn handle_ikev2(
-    mut state: &mut IKEState, current: &[u8], isakmp_header: IsakmpHeader, direction: Direction,
+    state: &mut IKEState, current: &[u8], isakmp_header: IsakmpHeader, direction: Direction,
 ) -> AppLayerResult {
     let hdr = IkeV2Header {
         init_spi: isakmp_header.init_spi,
index ab003629b58c9a571764b6b4ae2647b36c1bf6d6..25cce9bcf8267ed5d5e95ebb837248a24be5307d 100644 (file)
@@ -116,10 +116,7 @@ pub enum DetectKrb5TicketEncryptionData {
 pub fn detect_parse_encryption_weak(i: &str) -> IResult<&str, DetectKrb5TicketEncryptionData> {
     let (i, neg) = opt(char('!'))(i)?;
     let (i, _) = tag("weak")(i)?;
-    let value = match neg {
-        Some(_) => false,
-        _ => true,
-    };
+    let value = neg.is_none();
     return Ok((i, DetectKrb5TicketEncryptionData::WEAK(value)));
 }
 
index 909925972902005576e3a5677961266a15a5567b..d6b0a565c06056311cbe623b6ef1ab18cad4a508 100644 (file)
@@ -1951,7 +1951,7 @@ pub unsafe extern "C" fn rs_smb_parse_request_tcp(flow: *const Flow,
                                        )
                                        -> AppLayerResult
 {
-    let mut state = cast_pointer!(state, SMBState);
+    let state = cast_pointer!(state, SMBState);
     let flow = cast_pointer!(flow, Flow);
 
     if stream_slice.is_gap() {
@@ -1988,7 +1988,7 @@ pub unsafe extern "C" fn rs_smb_parse_response_tcp(flow: *const Flow,
                                         )
                                         -> AppLayerResult
 {
-    let mut state = cast_pointer!(state, SMBState);
+    let state = cast_pointer!(state, SMBState);
     let flow = cast_pointer!(flow, Flow);
 
     if stream_slice.is_gap() {
index 3e2a15b9f1b7725d70d780a4672fe8b263622cae..6280e0b6ace92cce10ac9e9d7bcbd44ba90e4c59 100644 (file)
@@ -110,7 +110,7 @@ impl SSHState {
     fn parse_record(
         &mut self, mut input: &[u8], resp: bool, pstate: *mut std::os::raw::c_void,
     ) -> AppLayerResult {
-        let (mut hdr, ohdr) = if !resp {
+        let (hdr, ohdr) = if !resp {
             (&mut self.transaction.cli_hdr, &self.transaction.srv_hdr)
         } else {
             (&mut self.transaction.srv_hdr, &self.transaction.cli_hdr)
@@ -240,7 +240,7 @@ impl SSHState {
     fn parse_banner(
         &mut self, input: &[u8], resp: bool, pstate: *mut std::os::raw::c_void,
     ) -> AppLayerResult {
-        let mut hdr = if !resp {
+        let hdr = if !resp {
             &mut self.transaction.cli_hdr
         } else {
             &mut self.transaction.srv_hdr