From 5956940f1fcb896e88dab0ad06dd6435d0aa28ac Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 5 Apr 2024 12:00:57 -0400 Subject: [PATCH] style: clean up new rustc warnings --- src/filters/body.rs | 3 --- src/filters/cors.rs | 5 +---- src/filters/fs.rs | 1 - src/filters/log.rs | 2 +- src/filters/query.rs | 1 - src/filters/sse.rs | 2 +- src/filters/trace.rs | 2 +- src/filters/ws.rs | 1 - src/reject.rs | 2 -- src/reply.rs | 14 -------------- src/test.rs | 1 - 11 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/filters/body.rs b/src/filters/body.rs index 85dabbfea..f533db3aa 100644 --- a/src/filters/body.rs +++ b/src/filters/body.rs @@ -12,10 +12,7 @@ use futures_util::{future, ready, Stream, TryFutureExt}; use headers::ContentLength; use http::header::CONTENT_TYPE; use hyper::Body; -use mime; use serde::de::DeserializeOwned; -use serde_json; -use serde_urlencoded; use crate::filter::{filter_fn, filter_fn_one, Filter, FilterBase}; use crate::reject::{self, Rejection}; diff --git a/src/filters/cors.rs b/src/filters/cors.rs index 39ea240e3..8276a7c2c 100644 --- a/src/filters/cors.rs +++ b/src/filters/cors.rs @@ -9,10 +9,7 @@ use std::sync::Arc; use headers::{ AccessControlAllowHeaders, AccessControlAllowMethods, AccessControlExposeHeaders, HeaderMapExt, }; -use http::{ - self, - header::{self, HeaderName, HeaderValue}, -}; +use http::header::{self, HeaderName, HeaderValue}; use crate::filter::{Filter, WrapSealed}; use crate::reject::{CombineRejection, Rejection}; diff --git a/src/filters/fs.rs b/src/filters/fs.rs index fdfa70968..584eaeb7f 100644 --- a/src/filters/fs.rs +++ b/src/filters/fs.rs @@ -19,7 +19,6 @@ use headers::{ }; use http::StatusCode; use hyper::Body; -use mime_guess; use percent_encoding::percent_decode_str; use tokio::fs::File as TkFile; use tokio::io::AsyncSeekExt; diff --git a/src/filters/log.rs b/src/filters/log.rs index 3790fd8a8..dee5672eb 100644 --- a/src/filters/log.rs +++ b/src/filters/log.rs @@ -4,7 +4,7 @@ use std::fmt; use std::net::SocketAddr; use std::time::{Duration, Instant}; -use http::{self, header, StatusCode}; +use http::{header, StatusCode}; use crate::filter::{Filter, WrapSealed}; use crate::reject::IsReject; diff --git a/src/filters/query.rs b/src/filters/query.rs index 7aee56948..515b8caef 100644 --- a/src/filters/query.rs +++ b/src/filters/query.rs @@ -2,7 +2,6 @@ use futures_util::future; use serde::de::DeserializeOwned; -use serde_urlencoded; use crate::filter::{filter_fn_one, Filter, One}; use crate::reject::{self, Rejection}; diff --git a/src/filters/sse.rs b/src/filters/sse.rs index 413456aab..714a1b59e 100644 --- a/src/filters/sse.rs +++ b/src/filters/sse.rs @@ -55,7 +55,7 @@ use futures_util::{future, Stream, TryStream, TryStreamExt}; use http::header::{HeaderValue, CACHE_CONTROL, CONTENT_TYPE}; use hyper::Body; use pin_project::pin_project; -use serde_json::{self, Error}; +use serde_json::Error; use tokio::time::{self, Sleep}; use self::sealed::SseError; diff --git a/src/filters/trace.rs b/src/filters/trace.rs index 60686b430..ee2618d36 100644 --- a/src/filters/trace.rs +++ b/src/filters/trace.rs @@ -12,7 +12,7 @@ use tracing::Span; use std::net::SocketAddr; -use http::{self, header}; +use http::header; use crate::filter::{Filter, WrapSealed}; use crate::reject::IsReject; diff --git a/src/filters/ws.rs b/src/filters/ws.rs index 81a6273cb..9ca374fbb 100644 --- a/src/filters/ws.rs +++ b/src/filters/ws.rs @@ -12,7 +12,6 @@ use crate::reject::Rejection; use crate::reply::{Reply, Response}; use futures_util::{future, ready, FutureExt, Sink, Stream, TryFutureExt}; use headers::{Connection, HeaderMapExt, SecWebsocketAccept, SecWebsocketKey, Upgrade}; -use http; use hyper::upgrade::OnUpgrade; use tokio_tungstenite::{ tungstenite::protocol::{self, WebSocketConfig}, diff --git a/src/reject.rs b/src/reject.rs index 6b19b4e6e..c79b96aa7 100644 --- a/src/reject.rs +++ b/src/reject.rs @@ -62,7 +62,6 @@ use std::error::Error as StdError; use std::fmt; use http::{ - self, header::{HeaderValue, CONTENT_TYPE}, StatusCode, }; @@ -707,7 +706,6 @@ mod sealed { #[cfg(test)] mod tests { use super::*; - use http::StatusCode; #[derive(Debug, PartialEq)] struct Left; diff --git a/src/reply.rs b/src/reply.rs index 79e6dfd0e..428e6b91f 100644 --- a/src/reply.rs +++ b/src/reply.rs @@ -35,15 +35,12 @@ use std::borrow::Cow; use std::convert::TryFrom; -use std::error::Error as StdError; -use std::fmt; use crate::generic::{Either, One}; use http::header::{HeaderName, HeaderValue, CONTENT_TYPE}; use http::StatusCode; use hyper::Body; use serde::Serialize; -use serde_json; // This re-export just looks weird in docs... pub(crate) use self::sealed::Reply_; @@ -131,17 +128,6 @@ impl Reply for Json { } } -#[derive(Debug)] -pub(crate) struct ReplyJsonError; - -impl fmt::Display for ReplyJsonError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_str("warp::reply::json() failed") - } -} - -impl StdError for ReplyJsonError {} - /// Reply with a body and `content-type` set to `text/html; charset=utf-8`. /// /// # Example diff --git a/src/test.rs b/src/test.rs index ca2710fae..947c09025 100644 --- a/src/test.rs +++ b/src/test.rs @@ -104,7 +104,6 @@ use http::{ Response, }; use serde::Serialize; -use serde_json; #[cfg(feature = "websocket")] use tokio::sync::oneshot;