From 706a3b4ac46edd3adc344ecb263cb5d2a4a057a3 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 21 Feb 2022 12:04:09 +0100 Subject: [PATCH] Formatting & clippy --- src/client.rs | 6 +++--- src/endpoint.rs | 8 +++++--- src/lib.rs | 2 +- src/proto2.rs | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/client.rs b/src/client.rs index e2d5d84..62f876b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,8 +1,8 @@ +use std::borrow::Borrow; use std::collections::HashMap; use std::net::SocketAddr; use std::sync::atomic::{self, AtomicU32}; use std::sync::{Arc, Mutex}; -use std::borrow::Borrow; use arc_swap::ArcSwapOption; use log::{debug, error, trace}; @@ -120,10 +120,10 @@ impl ClientConn { self.query_send.store(None); } - pub(crate) async fn call<'a, T, B>( + pub(crate) async fn call( self: Arc, rq: B, - path: &'a str, + path: &str, prio: RequestPriority, ) -> Result<::Response, Error> where diff --git a/src/endpoint.rs b/src/endpoint.rs index b408241..bb5399c 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -1,6 +1,6 @@ +use std::borrow::Borrow; use std::marker::PhantomData; use std::sync::Arc; -use std::borrow::Borrow; use arc_swap::ArcSwapOption; use async_trait::async_trait; @@ -94,8 +94,10 @@ where target: &NodeID, req: B, prio: RequestPriority, - ) -> Result<::Response, Error> - where B: Borrow { + ) -> Result<::Response, Error> + where + B: Borrow, + { if *target == self.netapp.id { match self.handler.load_full() { None => Err(Error::NoHandler), diff --git a/src/lib.rs b/src/lib.rs index 89b4f32..cb24337 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,8 +19,8 @@ pub mod util; pub mod endpoint; pub mod proto; -mod proto2; mod client; +mod proto2; mod server; pub mod netapp; diff --git a/src/proto2.rs b/src/proto2.rs index 4e126d3..7210781 100644 --- a/src/proto2.rs +++ b/src/proto2.rs @@ -1,5 +1,5 @@ -use crate::proto::*; use crate::error::*; +use crate::proto::*; pub(crate) struct QueryMessage<'a> { pub(crate) prio: RequestPriority, @@ -58,7 +58,7 @@ impl<'a> QueryMessage<'a> { let path = &bytes[2..2 + path_length]; let telemetry_id = if telemetry_id_len > 0 { - Some(bytes[3 + path_length .. 3 + path_length + telemetry_id_len].to_vec()) + Some(bytes[3 + path_length..3 + path_length + telemetry_id_len].to_vec()) } else { None };