mirror of https://github.com/fafhrd91/actix-web
clippy
This commit is contained in:
parent
6353fdc581
commit
93840507e1
|
@ -1,6 +1,6 @@
|
|||
[alias]
|
||||
chk = "hack check --workspace --all-features --tests --examples"
|
||||
lint = "hack --clean-per-run clippy --workspace --tests --examples"
|
||||
lint = "clippy --workspace --tests --examples"
|
||||
ci-min = "hack check --workspace --no-default-features"
|
||||
ci-min-test = "hack check --workspace --no-default-features --tests --examples"
|
||||
ci-default = "hack check --workspace"
|
||||
|
|
|
@ -74,7 +74,7 @@ mod tests {
|
|||
use actix_utils::future::poll_fn;
|
||||
use derive_more::{Display, Error};
|
||||
use futures_core::ready;
|
||||
use futures_util::{stream, FutureExt};
|
||||
use futures_util::{stream, FutureExt as _};
|
||||
|
||||
use super::*;
|
||||
use crate::body::to_bytes;
|
||||
|
@ -134,7 +134,7 @@ mod tests {
|
|||
#[derive(Debug)]
|
||||
enum TimeDelayStream {
|
||||
Start,
|
||||
Sleep(#[pin] Sleep),
|
||||
Sleep(Pin<Box<Sleep>>),
|
||||
Done,
|
||||
}
|
||||
|
||||
|
@ -145,24 +145,22 @@ mod tests {
|
|||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
) -> Poll<Option<Self::Item>> {
|
||||
let this = self.as_mut().project();
|
||||
|
||||
match this {
|
||||
TimeDelayStreamProj::Start => {
|
||||
match self.as_mut().get_mut() {
|
||||
TimeDelayStream::Start => {
|
||||
let sleep = sleep(Duration::from_millis(1));
|
||||
self.set(TimeDelayStream::Sleep(sleep));
|
||||
self.as_mut().set(TimeDelayStream::Sleep(Box::pin(sleep)));
|
||||
cx.waker().wake_by_ref();
|
||||
Poll::Pending
|
||||
}
|
||||
|
||||
TimeDelayStreamProj::Sleep(mut delay) => {
|
||||
TimeDelayStream::Sleep(ref mut delay) => {
|
||||
ready!(delay.poll_unpin(cx));
|
||||
self.set(TimeDelayStream::Done);
|
||||
cx.waker().wake_by_ref();
|
||||
Poll::Pending
|
||||
}
|
||||
|
||||
TimeDelayStreamProj::Done => Poll::Ready(Some(Err(StreamErr))),
|
||||
TimeDelayStream::Done => Poll::Ready(Some(Err(StreamErr))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ where
|
|||
header::CONTENT_TYPE,
|
||||
header::HeaderValue::from_static("text/plain; charset=utf-8"),
|
||||
);
|
||||
res.set_body(Body::from(buf.into_inner())).into()
|
||||
res.set_body(Body::from(buf.into_inner()))
|
||||
}
|
||||
|
||||
InternalErrorType::Response(ref resp) => {
|
||||
|
|
|
@ -487,7 +487,7 @@ mod tests {
|
|||
};
|
||||
let resp =
|
||||
HttpResponse::BadRequest().body(serde_json::to_string(&msg).unwrap());
|
||||
InternalError::from_response(err, resp.into()).into()
|
||||
InternalError::from_response(err, resp).into()
|
||||
}))
|
||||
.to_http_parts();
|
||||
|
||||
|
|
|
@ -296,11 +296,8 @@ mod tests {
|
|||
async fn test_custom_err_handler() {
|
||||
let (req, mut pl) = TestRequest::with_uri("/name/user1/")
|
||||
.app_data(PathConfig::default().error_handler(|err, _| {
|
||||
error::InternalError::from_response(
|
||||
err,
|
||||
HttpResponse::Conflict().finish().into(),
|
||||
)
|
||||
.into()
|
||||
error::InternalError::from_response(err, HttpResponse::Conflict().finish())
|
||||
.into()
|
||||
}))
|
||||
.to_http_parts();
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ mod tests {
|
|||
let req = TestRequest::with_uri("/name/user1/")
|
||||
.app_data(QueryConfig::default().error_handler(|e, _| {
|
||||
let resp = HttpResponse::UnprocessableEntity().finish();
|
||||
InternalError::from_response(e, resp.into()).into()
|
||||
InternalError::from_response(e, resp).into()
|
||||
}))
|
||||
.to_srv_request();
|
||||
|
||||
|
|
Loading…
Reference in New Issue