fix clippy and globalref and android

This commit is contained in:
John Smith
2022-03-13 12:45:36 -04:00
parent f7f4d86cf1
commit 2cdfa59bb6
13 changed files with 97 additions and 107 deletions

View File

@@ -133,15 +133,14 @@ async fn main() -> Result<(), String> {
}
}
// Get client address
let server_addrs;
if let Some(address_arg) = matches.value_of("address") {
server_addrs = address_arg
let server_addrs = if let Some(address_arg) = matches.value_of("address") {
address_arg
.to_socket_addrs()
.map_err(|e| format!("Invalid server address '{}'", e))?
.collect()
} else {
server_addrs = settings.address.addrs.clone();
}
settings.address.addrs.clone()
};
let server_addr = server_addrs.first().cloned();
// Create command processor

View File

@@ -1,7 +1,5 @@
use directories::*;
use serde_derive::*;
use std::ffi::OsStr;
use std::net::{SocketAddr, ToSocketAddrs};
@@ -116,9 +114,7 @@ impl<'de> serde::Deserialize<'de> for NamedSocketAddrs {
D: serde::Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
let addr_iter = s
.to_socket_addrs()
.map_err(serde::de::Error::custom)?;
let addr_iter = s.to_socket_addrs().map_err(serde::de::Error::custom)?;
Ok(NamedSocketAddrs {
name: s,
addrs: addr_iter.collect(),
@@ -206,13 +202,12 @@ pub struct Settings {
impl Settings {
pub fn get_default_config_path() -> PathBuf {
// Get default configuration file location
let mut default_config_path;
if let Some(my_proj_dirs) = ProjectDirs::from("org", "Veilid", "Veilid") {
default_config_path = PathBuf::from(my_proj_dirs.config_dir());
} else {
default_config_path = PathBuf::from("./");
}
let mut default_config_path =
if let Some(my_proj_dirs) = ProjectDirs::from("org", "Veilid", "Veilid") {
PathBuf::from(my_proj_dirs.config_dir())
} else {
PathBuf::from("./")
};
default_config_path.push("veilid-client.conf");
default_config_path
@@ -220,13 +215,12 @@ impl Settings {
pub fn get_default_log_directory() -> PathBuf {
// Get default configuration file location
let mut default_log_directory;
if let Some(my_proj_dirs) = ProjectDirs::from("org", "Veilid", "Veilid") {
default_log_directory = PathBuf::from(my_proj_dirs.config_dir());
} else {
default_log_directory = PathBuf::from("./");
}
let mut default_log_directory =
if let Some(my_proj_dirs) = ProjectDirs::from("org", "Veilid", "Veilid") {
PathBuf::from(my_proj_dirs.config_dir())
} else {
PathBuf::from("./")
};
default_log_directory.push("logs/");
default_log_directory

View File

@@ -557,14 +557,14 @@ impl UI {
}
ConnectionState::Retrying(addr, _) => {
status.append_styled(
format!("Reconnecting to {} ", addr.to_string()),
format!("Reconnecting to {} ", addr),
ColorStyle::highlight_inactive(),
);
status.append_styled("|", ColorStyle::highlight_inactive());
}
ConnectionState::Connected(addr, _) => {
status.append_styled(
format!("Connected to {} ", addr.to_string()),
format!("Connected to {} ", addr),
ColorStyle::highlight_inactive(),
);
status.append_styled("|", ColorStyle::highlight_inactive());