relay: performed code clean up and optimisation with clippy
This commit is contained in:
parent
d87aa69964
commit
6a862648e7
3 changed files with 16 additions and 10 deletions
22
src/args.rs
22
src/args.rs
|
|
@ -59,6 +59,12 @@ pub enum Commands {
|
|||
},
|
||||
}
|
||||
|
||||
impl Default for Args {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl Args {
|
||||
pub fn new() -> Self {
|
||||
Self::parse()
|
||||
|
|
@ -68,25 +74,25 @@ impl Args {
|
|||
// client: Client,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
match &self.command {
|
||||
Some(Commands::Send { relay, file }) => {
|
||||
Some(Commands::Send { relay: _, file }) => {
|
||||
sender::send_info(file.as_deref().unwrap_or("test.txt")).await?;
|
||||
}
|
||||
Some(Commands::Receive {
|
||||
relay,
|
||||
overwrite,
|
||||
relay: _,
|
||||
overwrite: _,
|
||||
name,
|
||||
}) => {
|
||||
let transfer_name = name.as_deref().unwrap_or("None");
|
||||
receiver::download_info(transfer_name).await?
|
||||
}
|
||||
Some(Commands::Serve { port }) => {
|
||||
Some(Commands::Serve { port: _ }) => {
|
||||
http_server::start_server().await;
|
||||
}
|
||||
Some(Commands::Config {
|
||||
path,
|
||||
show,
|
||||
edit,
|
||||
reset,
|
||||
path: _,
|
||||
show: _,
|
||||
edit: _,
|
||||
reset: _,
|
||||
}) => {}
|
||||
None => {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use http_body_util::{BodyExt, Empty, Full};
|
||||
use http_body_util::{BodyExt, Full};
|
||||
use hyper::{body::Bytes, Request, StatusCode};
|
||||
use hyper_util::rt::TokioIo;
|
||||
use tokio::{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use axum::{
|
|||
routing::{get, post},
|
||||
Router,
|
||||
};
|
||||
use axum_client_ip::{InsecureClientIp, SecureClientIp, SecureClientIpSource};
|
||||
use axum_client_ip::{SecureClientIpSource};
|
||||
use log::info;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue