]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
rust: fix clippy lint for explicit_auto_deref
authorJason Ish <jason.ish@oisf.net>
Mon, 3 Oct 2022 21:35:35 +0000 (15:35 -0600)
committerVictor Julien <vjulien@oisf.net>
Tue, 4 Oct 2022 09:22:02 +0000 (11:22 +0200)
This adds unnecessary complexity to code.

rust/src/http2/parser.rs
rust/src/mqtt/mqtt.rs
rust/src/mqtt/mqtt_message.rs

index df139b57cf91adbf80d0f5cd01cf82b970aa40d6..5bc73814d58665dc504ba2536e55298c70212bd6 100644 (file)
@@ -57,7 +57,7 @@ impl std::str::FromStr for HTTP2FrameType {
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         let su = s.to_uppercase();
-        let su_slice: &str = &*su;
+        let su_slice: &str = &su;
         match su_slice {
             "DATA" => Ok(HTTP2FrameType::DATA),
             "HEADERS" => Ok(HTTP2FrameType::HEADERS),
@@ -132,7 +132,7 @@ impl std::str::FromStr for HTTP2ErrorCode {
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         let su = s.to_uppercase();
-        let su_slice: &str = &*su;
+        let su_slice: &str = &su;
         match su_slice {
             "NO_ERROR" => Ok(HTTP2ErrorCode::NOERROR),
             "PROTOCOL_ERROR" => Ok(HTTP2ErrorCode::PROTOCOLERROR),
@@ -702,7 +702,7 @@ impl std::str::FromStr for HTTP2SettingsId {
 
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         let su = s.to_uppercase();
-        let su_slice: &str = &*su;
+        let su_slice: &str = &su;
         match su_slice {
             "SETTINGS_HEADER_TABLE_SIZE" => Ok(HTTP2SettingsId::SETTINGSHEADERTABLESIZE),
             "SETTINGS_ENABLE_PUSH" => Ok(HTTP2SettingsId::SETTINGSENABLEPUSH),
index 5cf624ccd4b278611cf6b0150394dbb548a82b4d..04691218d5b1ba0e26c2afb2ea852060396427d1 100644 (file)
@@ -309,9 +309,9 @@ impl MQTTState {
             }
             MQTTOperation::CONNACK(ref _connack) => {
                 if let Some(tx) = self.get_tx_by_pkt_id(MQTT_CONNECT_PKT_ID) {
-                    (*tx).msg.push(msg);
-                    (*tx).complete = true;
-                    (*tx).pkt_id = None;
+                    tx.msg.push(msg);
+                    tx.complete = true;
+                    tx.pkt_id = None;
                     self.connected = true;
                 } else {
                     let mut tx = self.new_tx(msg, toclient);
@@ -327,7 +327,7 @@ impl MQTTState {
                     return;
                 }
                 if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) {
-                    (*tx).msg.push(msg);
+                    tx.msg.push(msg);
                 } else {
                     let mut tx = self.new_tx(msg, toclient);
                     MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish);
@@ -342,9 +342,9 @@ impl MQTTState {
                     return;
                 }
                 if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) {
-                    (*tx).msg.push(msg);
-                    (*tx).complete = true;
-                    (*tx).pkt_id = None;
+                    tx.msg.push(msg);
+                    tx.complete = true;
+                    tx.pkt_id = None;
                 } else {
                     let mut tx = self.new_tx(msg, toclient);
                     MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish);
@@ -359,9 +359,9 @@ impl MQTTState {
                     return;
                 }
                 if let Some(tx) = self.get_tx_by_pkt_id(suback.message_id as u32) {
-                    (*tx).msg.push(msg);
-                    (*tx).complete = true;
-                    (*tx).pkt_id = None;
+                    tx.msg.push(msg);
+                    tx.complete = true;
+                    tx.pkt_id = None;
                 } else {
                     let mut tx = self.new_tx(msg, toclient);
                     MQTTState::set_event(&mut tx, MQTTEvent::MissingSubscribe);
@@ -376,9 +376,9 @@ impl MQTTState {
                     return;
                 }
                 if let Some(tx) = self.get_tx_by_pkt_id(unsuback.message_id as u32) {
-                    (*tx).msg.push(msg);
-                    (*tx).complete = true;
-                    (*tx).pkt_id = None;
+                    tx.msg.push(msg);
+                    tx.complete = true;
+                    tx.pkt_id = None;
                 } else {
                     let mut tx = self.new_tx(msg, toclient);
                     MQTTState::set_event(&mut tx, MQTTEvent::MissingUnsubscribe);
index aadcf83e1cdb847891655375822f49b31c2fc2a5..62ad006c128a620075d1eec07476a8eb500b81bf 100644 (file)
@@ -88,7 +88,7 @@ impl std::str::FromStr for MQTTTypeCode {
     type Err = String;
     fn from_str(s: &str) -> Result<Self, Self::Err> {
         let su = s.to_uppercase();
-        let su_slice: &str = &*su;
+        let su_slice: &str = &su;
         match su_slice {
             "CONNECT" => Ok(MQTTTypeCode::CONNECT),
             "CONNACK" => Ok(MQTTTypeCode::CONNACK),