mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
clippy all codes (#1214)
1. clippy code 2. add fmt and clippy check in ci
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use crate::{
|
||||
common::config::ConfigLoader, launcher::ConfigSource, instance_manager::NetworkInstanceManager, proto::{
|
||||
common::config::ConfigLoader,
|
||||
instance_manager::NetworkInstanceManager,
|
||||
launcher::ConfigSource,
|
||||
proto::{
|
||||
rpc_types::{self, controller::BaseController},
|
||||
web::{
|
||||
CollectNetworkInfoRequest, CollectNetworkInfoResponse, DeleteNetworkInstanceRequest,
|
||||
@@ -8,7 +11,7 @@ use crate::{
|
||||
RetainNetworkInstanceResponse, RunNetworkInstanceRequest, RunNetworkInstanceResponse,
|
||||
ValidateConfigRequest, ValidateConfigResponse, WebClientService,
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
pub struct Controller {
|
||||
@@ -108,7 +111,7 @@ impl WebClientService for Controller {
|
||||
if !include_inst_ids.is_empty() {
|
||||
let mut to_remove = Vec::new();
|
||||
for (k, _) in ret.map.iter() {
|
||||
if !include_inst_ids.contains(&k) {
|
||||
if !include_inst_ids.contains(k) {
|
||||
to_remove.push(k.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,15 @@ pub struct WebClient {
|
||||
}
|
||||
|
||||
impl WebClient {
|
||||
pub fn new<T: TunnelConnector + 'static, S: ToString, H: ToString>(connector: T, token: S, hostname: H) -> Self {
|
||||
let controller = Arc::new(controller::Controller::new(token.to_string(),
|
||||
hostname.to_string()));
|
||||
pub fn new<T: TunnelConnector + 'static, S: ToString, H: ToString>(
|
||||
connector: T,
|
||||
token: S,
|
||||
hostname: H,
|
||||
) -> Self {
|
||||
let controller = Arc::new(controller::Controller::new(
|
||||
token.to_string(),
|
||||
hostname.to_string(),
|
||||
));
|
||||
|
||||
let controller_clone = controller.clone();
|
||||
let tasks = ScopedTask::from(tokio::spawn(async move {
|
||||
|
||||
@@ -114,7 +114,7 @@ impl Session {
|
||||
}
|
||||
Ok(resp) => {
|
||||
tracing::debug!("heartbeat response: {:?}", resp);
|
||||
let _ = ctx_clone.notifier.send(resp.clone());
|
||||
let _ = ctx_clone.notifier.send(resp);
|
||||
ctx_clone.resp.lock().await.replace(resp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user