Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: clean up new rustc warnings #1097

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/filters/body.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ use http::{
Response,
};
use serde::Serialize;
use serde_json;
#[cfg(feature = "websocket")]
use tokio::sync::oneshot;

Expand Down