Fix clippy warnings & errors after Rust update.

This commit is contained in:
Orne Brocaar 2023-10-16 12:18:45 +01:00
parent b4845b5613
commit a9e1f02f0f
8 changed files with 9 additions and 12 deletions

View File

@ -174,7 +174,7 @@ impl JoinAccept<'_> {
.gateway_tenant_id_map
.get(&gw_id)
.map(|v| v.into_bytes().to_vec())
.unwrap_or_else(Vec::new),
.unwrap_or_default(),
}
})
.collect(),

View File

@ -92,7 +92,7 @@ impl PassiveRoamingDownlink {
.gateway_tenant_id_map
.get(&gw_id)
.map(|v| v.into_bytes().to_vec())
.unwrap_or_else(Vec::new),
.unwrap_or_default(),
}
})
.collect(),

View File

@ -667,7 +667,7 @@ impl TxAck {
let mut plaintext_frm_payload = false;
if let Payload::MACPayload(pl) = &phy.payload {
// f_port must be either 0 or 226 (Relay).
if vec![0, lrwn::LA_FPORT_RELAY].contains(&pl.f_port.unwrap_or(0)) {
if [0, lrwn::LA_FPORT_RELAY].contains(&pl.f_port.unwrap_or(0)) {
phy.decrypt_frm_payload(&nwk_s_enc_key)?;
plaintext_frm_payload = true;
}

View File

@ -145,9 +145,9 @@ impl<'a> Integration<'a> {
command_regex: Regex::new(&templates.render(
"command_topic",
&CommandTopicContext {
application_id: r#"(?P<application_id>[\w-]+)"#.to_string(),
dev_eui: r#"(?P<dev_eui>[\w]+)"#.to_string(),
command: r#"(?P<command>[\w]+)"#.to_string(),
application_id: r"(?P<application_id>[\w-]+)".to_string(),
dev_eui: r"(?P<dev_eui>[\w]+)".to_string(),
command: r"(?P<command>[\w]+)".to_string(),
},
)?)?,
qos: conf.qos,

View File

@ -311,7 +311,6 @@ pub async fn get_for_phypayload(
async fn get_dev_euis_for_dev_addr(dev_addr: DevAddr) -> Result<Vec<EUI64>> {
task::spawn_blocking({
let dev_addr = dev_addr;
move || -> Result<Vec<EUI64>> {
let key = redis_key(format!("devaddr:{{{}}}", dev_addr));
let mut c = get_redis_conn()?;
@ -333,8 +332,6 @@ async fn get_dev_euis_for_dev_addr(dev_addr: DevAddr) -> Result<Vec<EUI64>> {
async fn remove_dev_eui_from_dev_addr_set(dev_addr: DevAddr, dev_eui: EUI64) -> Result<()> {
task::spawn_blocking({
let dev_addr = dev_addr;
let dev_eui = dev_eui;
move || -> Result<()> {
let key = redis_key(format!("devaddr:{{{}}}", dev_addr));
let mut c = get_redis_conn()?;

View File

@ -458,7 +458,7 @@ impl Data {
.gateway_tenant_id_map
.get(&gw_id)
.map(|v| v.into_bytes().to_vec())
.unwrap_or_else(Vec::new),
.unwrap_or_default(),
}
})
.collect(),

View File

@ -253,7 +253,7 @@ impl JoinRequest {
}
};
if !self.device_keys.is_some() {
if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(&jr.join_eui)?);
}

View File

@ -145,7 +145,7 @@ impl JoinRequest {
}
};
if !self.device_keys.is_some() {
if self.device_keys.is_none() {
trace!(join_eui = %jr.join_eui, "Getting Join Server client");
self.js_client = Some(joinserver::get(&jr.join_eui)?);
}