rust: fix clippy lint for explicit_auto_deref

This adds unnecessary complexity to code.
pull/7966/head
Jason Ish 3 years ago committed by Victor Julien
parent c503ca62e2
commit 7d623f0854

@ -57,7 +57,7 @@ impl std::str::FromStr for HTTP2FrameType {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let su = s.to_uppercase(); let su = s.to_uppercase();
let su_slice: &str = &*su; let su_slice: &str = &su;
match su_slice { match su_slice {
"DATA" => Ok(HTTP2FrameType::DATA), "DATA" => Ok(HTTP2FrameType::DATA),
"HEADERS" => Ok(HTTP2FrameType::HEADERS), "HEADERS" => Ok(HTTP2FrameType::HEADERS),
@ -132,7 +132,7 @@ impl std::str::FromStr for HTTP2ErrorCode {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let su = s.to_uppercase(); let su = s.to_uppercase();
let su_slice: &str = &*su; let su_slice: &str = &su;
match su_slice { match su_slice {
"NO_ERROR" => Ok(HTTP2ErrorCode::NOERROR), "NO_ERROR" => Ok(HTTP2ErrorCode::NOERROR),
"PROTOCOL_ERROR" => Ok(HTTP2ErrorCode::PROTOCOLERROR), "PROTOCOL_ERROR" => Ok(HTTP2ErrorCode::PROTOCOLERROR),
@ -702,7 +702,7 @@ impl std::str::FromStr for HTTP2SettingsId {
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let su = s.to_uppercase(); let su = s.to_uppercase();
let su_slice: &str = &*su; let su_slice: &str = &su;
match su_slice { match su_slice {
"SETTINGS_HEADER_TABLE_SIZE" => Ok(HTTP2SettingsId::SETTINGSHEADERTABLESIZE), "SETTINGS_HEADER_TABLE_SIZE" => Ok(HTTP2SettingsId::SETTINGSHEADERTABLESIZE),
"SETTINGS_ENABLE_PUSH" => Ok(HTTP2SettingsId::SETTINGSENABLEPUSH), "SETTINGS_ENABLE_PUSH" => Ok(HTTP2SettingsId::SETTINGSENABLEPUSH),

@ -309,9 +309,9 @@ impl MQTTState {
} }
MQTTOperation::CONNACK(ref _connack) => { MQTTOperation::CONNACK(ref _connack) => {
if let Some(tx) = self.get_tx_by_pkt_id(MQTT_CONNECT_PKT_ID) { if let Some(tx) = self.get_tx_by_pkt_id(MQTT_CONNECT_PKT_ID) {
(*tx).msg.push(msg); tx.msg.push(msg);
(*tx).complete = true; tx.complete = true;
(*tx).pkt_id = None; tx.pkt_id = None;
self.connected = true; self.connected = true;
} else { } else {
let mut tx = self.new_tx(msg, toclient); let mut tx = self.new_tx(msg, toclient);
@ -327,7 +327,7 @@ impl MQTTState {
return; return;
} }
if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) { if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) {
(*tx).msg.push(msg); tx.msg.push(msg);
} else { } else {
let mut tx = self.new_tx(msg, toclient); let mut tx = self.new_tx(msg, toclient);
MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish); MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish);
@ -342,9 +342,9 @@ impl MQTTState {
return; return;
} }
if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) { if let Some(tx) = self.get_tx_by_pkt_id(v.message_id as u32) {
(*tx).msg.push(msg); tx.msg.push(msg);
(*tx).complete = true; tx.complete = true;
(*tx).pkt_id = None; tx.pkt_id = None;
} else { } else {
let mut tx = self.new_tx(msg, toclient); let mut tx = self.new_tx(msg, toclient);
MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish); MQTTState::set_event(&mut tx, MQTTEvent::MissingPublish);
@ -359,9 +359,9 @@ impl MQTTState {
return; return;
} }
if let Some(tx) = self.get_tx_by_pkt_id(suback.message_id as u32) { if let Some(tx) = self.get_tx_by_pkt_id(suback.message_id as u32) {
(*tx).msg.push(msg); tx.msg.push(msg);
(*tx).complete = true; tx.complete = true;
(*tx).pkt_id = None; tx.pkt_id = None;
} else { } else {
let mut tx = self.new_tx(msg, toclient); let mut tx = self.new_tx(msg, toclient);
MQTTState::set_event(&mut tx, MQTTEvent::MissingSubscribe); MQTTState::set_event(&mut tx, MQTTEvent::MissingSubscribe);
@ -376,9 +376,9 @@ impl MQTTState {
return; return;
} }
if let Some(tx) = self.get_tx_by_pkt_id(unsuback.message_id as u32) { if let Some(tx) = self.get_tx_by_pkt_id(unsuback.message_id as u32) {
(*tx).msg.push(msg); tx.msg.push(msg);
(*tx).complete = true; tx.complete = true;
(*tx).pkt_id = None; tx.pkt_id = None;
} else { } else {
let mut tx = self.new_tx(msg, toclient); let mut tx = self.new_tx(msg, toclient);
MQTTState::set_event(&mut tx, MQTTEvent::MissingUnsubscribe); MQTTState::set_event(&mut tx, MQTTEvent::MissingUnsubscribe);

@ -88,7 +88,7 @@ impl std::str::FromStr for MQTTTypeCode {
type Err = String; type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
let su = s.to_uppercase(); let su = s.to_uppercase();
let su_slice: &str = &*su; let su_slice: &str = &su;
match su_slice { match su_slice {
"CONNECT" => Ok(MQTTTypeCode::CONNECT), "CONNECT" => Ok(MQTTTypeCode::CONNECT),
"CONNACK" => Ok(MQTTTypeCode::CONNACK), "CONNACK" => Ok(MQTTTypeCode::CONNACK),

Loading…
Cancel
Save