From a83919a719fab38d8d4fd846a48c3de389eb0d22 Mon Sep 17 00:00:00 2001 From: LukeMathWalker Date: Fri, 13 Aug 2021 11:02:32 +0100 Subject: [PATCH] Fix linter errors. --- src/lib.rs | 16 ++++++---------- src/middleware.rs | 1 + src/request_id.rs | 9 +++++---- src/root_span.rs | 8 ++++---- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index c84761d55..6b7681709 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,16 +28,12 @@ //! use actix_web::{App, web, HttpServer}; //! use tracing_actix_web::TracingLogger; //! -//! fn main() { -//! // Init your `tracing` subscriber here! -//! -//! let server = HttpServer::new(|| { -//! App::new() -//! // Mount `TracingLogger` as a middleware -//! .wrap(TracingLogger::default()) -//! .service( /* */ ) -//! }); -//! } +//! let server = HttpServer::new(|| { +//! App::new() +//! // Mount `TracingLogger` as a middleware +//! .wrap(TracingLogger::default()) +//! .service( /* */ ) +//! }); //! ``` //! //! Check out [the examples on GitHub](https://github.com/LukeMathWalker/tracing-actix-web/tree/main/examples) to get a taste of how [`TracingLogger`] can be used to observe and monitor your diff --git a/src/middleware.rs b/src/middleware.rs index 95b5a7df6..ad8953e22 100644 --- a/src/middleware.rs +++ b/src/middleware.rs @@ -113,6 +113,7 @@ pub struct TracingLoggerMiddleware { root_span_builder: std::marker::PhantomData, } +#[allow(clippy::type_complexity)] impl Service for TracingLoggerMiddleware where S: Service, Error = Error>, diff --git a/src/request_id.rs b/src/request_id.rs index 9cebf409d..7debf3f0a 100644 --- a/src/request_id.rs +++ b/src/request_id.rs @@ -42,9 +42,9 @@ impl std::ops::Deref for RequestId { } } -impl std::convert::Into for RequestId { - fn into(self) -> Uuid { - self.0 +impl From for Uuid { + fn from(r: RequestId) -> Self { + r.0 } } @@ -53,10 +53,11 @@ impl std::fmt::Display for RequestId { write!(f, "{}", self.0) } } + impl FromRequest for RequestId { + type Config = (); type Error = RequestIdExtractionError; type Future = Ready>; - type Config = (); fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future { ready( diff --git a/src/root_span.rs b/src/root_span.rs index 804f7ad43..16e032eb0 100644 --- a/src/root_span.rs +++ b/src/root_span.rs @@ -40,16 +40,16 @@ impl std::ops::Deref for RootSpan { } } -impl std::convert::Into for RootSpan { - fn into(self) -> Span { - self.0 +impl From for Span { + fn from(r: RootSpan) -> Self { + r.0 } } impl FromRequest for RootSpan { + type Config = (); type Error = RootSpanExtractionError; type Future = Ready>; - type Config = (); fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future { ready(