From d2c0ee7a8aad5eb995e4277374f7cc593197c38f Mon Sep 17 00:00:00 2001 From: Pranay Tulugu Date: Tue, 25 Jul 2023 12:15:59 -0700 Subject: [PATCH] clippy --- althea_types/src/wifi_info.rs | 42 +++++--------------------- rita_client/src/dashboard/operator.rs | 6 +--- rita_common/src/network_monitor/mod.rs | 2 +- 3 files changed, 9 insertions(+), 41 deletions(-) diff --git a/althea_types/src/wifi_info.rs b/althea_types/src/wifi_info.rs index 7b1e39bd9..be1241941 100644 --- a/althea_types/src/wifi_info.rs +++ b/althea_types/src/wifi_info.rs @@ -205,19 +205,11 @@ fn get_struct_stat(station: Vec<&str>) -> WifiStationData { } "authorized:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.authorized = true; - } else { - ret.authorized = false; - } + ret.authorized = *next_str == "yes"; } "authenticated:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.authenticated = true; - } else { - ret.authenticated = false; - } + ret.authenticated = *next_str == "yes"; } "[boottime]:" => { ret.associated_at_boottime_sec = Some(iter.next().unwrap().to_string()) @@ -227,36 +219,20 @@ fn get_struct_stat(station: Vec<&str>) -> WifiStationData { } "associated:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.associated = true; - } else { - ret.associated = false; - } + ret.associated = *next_str == "yes"; } "preamble:" => ret.preamble = iter.next().unwrap().to_string(), "WMM/WME:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.wmm_wme = true; - } else { - ret.wmm_wme = false; - } + ret.wmm_wme = *next_str == "yes"; } "MFP:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.mfp = true; - } else { - ret.mfp = false; - } + ret.mfp = *next_str == "yes"; } "peer:" => { let next_str = iter.next().unwrap(); - if *next_str == "yes" { - ret.tdls_peer = true; - } else { - ret.tdls_peer = false; - } + ret.tdls_peer = *next_str == "yes"; } "period:" => ret.dtim_period = iter.next().unwrap().parse::().unwrap_or(0u16), "beacon" => { @@ -266,11 +242,7 @@ fn get_struct_stat(station: Vec<&str>) -> WifiStationData { } "slot" => { let next_str = *iter.next().unwrap(); - if next_str.contains("yes") { - ret.short_slot_time = true; - } else { - ret.short_slot_time = false; - } + ret.short_slot_time = next_str.contains("yes"); } "connected" => { iter.next(); diff --git a/rita_client/src/dashboard/operator.rs b/rita_client/src/dashboard/operator.rs index ff250e5de..50ff1a59e 100644 --- a/rita_client/src/dashboard/operator.rs +++ b/rita_client/src/dashboard/operator.rs @@ -62,11 +62,7 @@ pub async fn set_operator_fee(fee: Path) -> HttpResponse { let mut rita_client = settings::get_rita_client(); rita_client.operator.operator_fee = op_fee; - if op_fee == 0_u8.into() { - rita_client.operator.use_operator_price = true - } else { - rita_client.operator.use_operator_price = false; - } + rita_client.operator.use_operator_price = op_fee == 0_u8.into(); settings::set_rita_client(rita_client); diff --git a/rita_common/src/network_monitor/mod.rs b/rita_common/src/network_monitor/mod.rs index 30fa76fd6..4de788cd5 100644 --- a/rita_common/src/network_monitor/mod.rs +++ b/rita_common/src/network_monitor/mod.rs @@ -131,7 +131,7 @@ pub struct NetworkInfo { /// updates babel neighbors, babel routes, and rita neighbors for a NetworkInfo pub fn update_network_info(msg: NetworkInfo) { - let mut network_monitor = &mut *(NETWORK_MONITOR.write().unwrap()); + let network_monitor = &mut *(NETWORK_MONITOR.write().unwrap()); let babel_neighbors = &msg.babel_neighbors; let babel_routes = &msg.babel_routes; let rita_neighbors = &msg.rita_neighbors;