clippy tidy-up
This commit is contained in:
parent
6fb5b58d6c
commit
91180ed1fe
|
@ -1,7 +1,3 @@
|
|||
// this is to ignore a clippy warning that suggests
|
||||
// to replace code with the same code that is already there (possibly a bug)
|
||||
#![allow(clippy::nonstandard_macro_braces)]
|
||||
|
||||
pub mod config_manager;
|
||||
pub mod dyndns_client;
|
||||
pub mod error;
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
//! Several helper methods are also included here which bundle multiple client
|
||||
//! calls to achieve the desired functionality.
|
||||
|
||||
// TODO: fix these clippy errors so this allow can be removed
|
||||
#![allow(clippy::needless_borrow)]
|
||||
|
||||
use std::env;
|
||||
|
||||
use jsonrpc_client_core::{expand_params, jsonrpc_client};
|
||||
|
@ -166,9 +163,9 @@ pub fn disable(iface: &str, ssid: &str) -> std::result::Result<String, PeachErro
|
|||
let mut client = PeachNetworkClient::new(transport_handle);
|
||||
|
||||
info!("Performing id call to peach-network microservice.");
|
||||
let id = client.id(&iface, &ssid).call()?;
|
||||
let id = client.id(iface, ssid).call()?;
|
||||
info!("Performing disable call to peach-network microservice.");
|
||||
client.disable(&id, &iface).call()?;
|
||||
client.disable(&id, iface).call()?;
|
||||
|
||||
let response = "success".to_string();
|
||||
|
||||
|
@ -194,12 +191,12 @@ pub fn forget(iface: &str, ssid: &str) -> std::result::Result<String, PeachError
|
|||
let mut client = PeachNetworkClient::new(transport_handle);
|
||||
|
||||
info!("Performing id call to peach-network microservice.");
|
||||
let id = client.id(&iface, &ssid).call()?;
|
||||
let id = client.id(iface, ssid).call()?;
|
||||
info!("Performing delete call to peach-network microservice.");
|
||||
// WEIRD BUG: the parameters below are technically in the wrong order:
|
||||
// it should be id first and then iface, but somehow they get twisted.
|
||||
// i don't understand computers.
|
||||
client.delete(&iface, &id).call()?;
|
||||
client.delete(iface, &id).call()?;
|
||||
info!("Performing save call to peach-network microservice.");
|
||||
client.save().call()?;
|
||||
|
||||
|
@ -357,8 +354,7 @@ pub fn saved_ap(ssid: &str) -> std::result::Result<bool, PeachError> {
|
|||
// retrieve a list of access points with saved credentials
|
||||
let saved_aps = match client.saved_networks().call() {
|
||||
Ok(ssids) => {
|
||||
let networks: Vec<Networks> = serde_json::from_str(ssids.as_str())
|
||||
.expect("Failed to deserialize saved_networks response");
|
||||
let networks: Vec<Networks> = serde_json::from_str(ssids.as_str())?;
|
||||
networks
|
||||
}
|
||||
// return an empty vector if there are no saved access point credentials
|
||||
|
@ -479,7 +475,7 @@ pub fn traffic(iface: &str) -> std::result::Result<Traffic, PeachError> {
|
|||
let mut client = PeachNetworkClient::new(transport_handle);
|
||||
|
||||
let response = client.traffic(iface).call()?;
|
||||
let t: Traffic = serde_json::from_str(&response).unwrap();
|
||||
let t: Traffic = serde_json::from_str(&response)?;
|
||||
|
||||
Ok(t)
|
||||
}
|
||||
|
@ -506,13 +502,13 @@ pub fn update(iface: &str, ssid: &str, pass: &str) -> std::result::Result<String
|
|||
|
||||
// get the id of the network
|
||||
info!("Performing id call to peach-network microservice.");
|
||||
let id = client.id(&iface, &ssid).call()?;
|
||||
let id = client.id(iface, ssid).call()?;
|
||||
// delete the old credentials
|
||||
// WEIRD BUG: the parameters below are technically in the wrong order:
|
||||
// it should be id first and then iface, but somehow they get twisted.
|
||||
// i don't understand computers.
|
||||
info!("Performing delete call to peach-network microservice.");
|
||||
client.delete(&iface, &id).call()?;
|
||||
client.delete(iface, &id).call()?;
|
||||
// save the updates to wpa_supplicant.conf
|
||||
info!("Performing save call to peach-network microservice.");
|
||||
client.save().call()?;
|
||||
|
|
Loading…
Reference in New Issue