From 7c27e231548a41502423781371f28ca8e1c91dbf Mon Sep 17 00:00:00 2001 From: sword-jin Date: Mon, 17 Jun 2024 05:52:32 +0000 Subject: [PATCH] fix lint --- src/client.rs | 2 +- src/config.rs | 8 ++++---- src/lib.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client.rs b/src/client.rs index 55616fc1..5ac60976 100644 --- a/src/client.rs +++ b/src/client.rs @@ -17,7 +17,7 @@ use std::net::SocketAddr; use std::sync::Arc; use tokio::io::{self, copy_bidirectional, AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpStream, UdpSocket}; -use tokio::sync::{broadcast, mpsc, oneshot, RwLock}; +use tokio::sync::{mpsc, oneshot, RwLock}; use tokio::time::{self, Duration, Instant}; use tokio_util::sync::CancellationToken; use tracing::{debug, error, info, instrument, trace, warn, Instrument, Span}; diff --git a/src/config.rs b/src/config.rs index ca85fc20..742aa4b9 100644 --- a/src/config.rs +++ b/src/config.rs @@ -255,9 +255,9 @@ impl Config { fn validate_server_config(server: &mut ServerConfig) -> Result<()> { // Validate services for (name, s) in &mut server.services { - s.name = name.clone(); + s.name.clone_from(name); if s.token.is_none() { - s.token = server.default_token.clone(); + s.token.clone_from(&server.default_token); if s.token.is_none() { bail!("The token of service {} is not set", name); } @@ -272,9 +272,9 @@ impl Config { fn validate_client_config(client: &mut ClientConfig) -> Result<()> { // Validate services for (name, s) in &mut client.services { - s.name = name.clone(); + s.name.clone_from(name); if s.token.is_none() { - s.token = client.default_token.clone(); + s.token.clone_from(&client.default_token); if s.token.is_none() { bail!("The token of service {} is not set", name); } diff --git a/src/lib.rs b/src/lib.rs index 3e371b55..343a0bd0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,7 +13,7 @@ pub use config::Config; pub use constants::UDP_BUFFER_SIZE; use anyhow::Result; -use tokio::sync::{broadcast, mpsc}; +use tokio::sync::mpsc; use tokio_util::sync::CancellationToken; use tracing::{debug, info};