diff --git a/src/client/mod.rs b/src/client/mod.rs index 13fb2a1..944bc39 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -3,7 +3,6 @@ use std::{fs::File, io::BufReader, sync::Arc}; use crate::{common::decode, Config}; -use anyhow; use libpt::log::{error, info, trace}; use rustls_pemfile::certs; use tokio::{ @@ -15,7 +14,6 @@ use tokio_rustls::{ rustls::{self, pki_types}, TlsConnector, }; -use webpki_roots; const BUF_SIZE: usize = 512; diff --git a/src/common/args.rs b/src/common/args.rs index 64c8d2b..efc7903 100644 --- a/src/common/args.rs +++ b/src/common/args.rs @@ -6,11 +6,11 @@ use clap::Parser; use clap_verbosity_flag::{InfoLevel, Verbosity}; /// short about section displayed in help -const ABOUT_ROOT: &'static str = r##" +const ABOUT_ROOT: &str = r##" Let your hosts play ping pong over the network "##; /// longer about section displayed in help, is combined with [the short help](ABOUT_ROOT) -static LONG_ABOUT_ROOT: &'static str = r##" +static LONG_ABOUT_ROOT: &str = r##" Connect to a ping pong server and periodically send a ping. The server will reply with a pong. That's it really. You can also host your own netpong server (server feature). @@ -79,6 +79,6 @@ impl Cli { // less verbose version Logger::init_mini(Some(ll)).expect("could not initialize Logger"); } - return cli; + cli } } diff --git a/src/common/mod.rs b/src/common/mod.rs index 098dde5..2802bbc 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -7,7 +7,7 @@ pub mod conf; pub fn decode(buf: &[u8]) -> Result { Ok(match std::str::from_utf8(buf) { Ok(s) => s.to_string(), - Err(err) => return Err(err.into()), + Err(err) => return Err(err), } .trim_matches(char::from(0)) .to_string()) diff --git a/src/main.rs b/src/main.rs index 5c73f3c..73e63e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,6 @@ use anyhow::Result; use libpt::log::*; -use tokio; mod client; mod common; diff --git a/src/server/mod.rs b/src/server/mod.rs index 007a95a..de3f82d 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -109,10 +109,10 @@ impl Server { error!("the server needs a key!"); return Err(std::io::ErrorKind::InvalidInput.into()); } - let key = private_key(&mut std::io::BufReader::new(File::open( + + private_key(&mut std::io::BufReader::new(File::open( cfg.key.clone().unwrap(), - )?)); - return key; + )?)) } fn load_certs(cfg: Config) -> std::io::Result>> { @@ -121,18 +121,18 @@ impl Server { return Err(std::io::ErrorKind::InvalidInput.into()); } match certs(&mut std::io::BufReader::new(File::open( - &cfg.certs.clone().unwrap(), + cfg.certs.clone().unwrap(), )?)) .collect::>>>() { Ok(v) if !v.is_empty() => Ok(v), Ok(_) => { error!("no certs found in provided file {:?}", cfg.certs); - return Err(std::io::ErrorKind::InvalidInput.into()); + Err(std::io::ErrorKind::InvalidInput.into()) } Err(err) => { error!("could not load certs: {err:?}"); - return Err(err); + Err(err) } } }