Skip to content

Commit

Permalink
style: clean up new rustc warnings (#1097)
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Apr 5, 2024
1 parent 7b07043 commit 46e99a0
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 30 deletions.
3 changes: 0 additions & 3 deletions src/filters/body.rs
Expand Up @@ -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};
Expand Down
5 changes: 1 addition & 4 deletions src/filters/cors.rs
Expand Up @@ -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};
Expand Down
1 change: 0 additions & 1 deletion src/filters/fs.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/filters/log.rs
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/filters/query.rs
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion src/filters/sse.rs
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/filters/trace.rs
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/filters/ws.rs
Expand Up @@ -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},
Expand Down
2 changes: 0 additions & 2 deletions src/reject.rs
Expand Up @@ -62,7 +62,6 @@ use std::error::Error as StdError;
use std::fmt;

use http::{
self,
header::{HeaderValue, CONTENT_TYPE},
StatusCode,
};
Expand Down Expand Up @@ -707,7 +706,6 @@ mod sealed {
#[cfg(test)]
mod tests {
use super::*;
use http::StatusCode;

#[derive(Debug, PartialEq)]
struct Left;
Expand Down
14 changes: 0 additions & 14 deletions src/reply.rs
Expand Up @@ -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_;
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/test.rs
Expand Up @@ -104,7 +104,6 @@ use http::{
Response,
};
use serde::Serialize;
use serde_json;
#[cfg(feature = "websocket")]
use tokio::sync::oneshot;

Expand Down

0 comments on commit 46e99a0

Please sign in to comment.