1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

fmt & clippy

This commit is contained in:
Nikolay Kim
2019-09-12 21:52:46 +06:00
parent 45d2fd4299
commit 60b7aebd0a
15 changed files with 95 additions and 62 deletions

View File

@ -1,5 +1,5 @@
use std::{fmt, io, net};
use std::rc::Rc;
use std::{fmt, io, net};
use actix_codec::{AsyncRead, AsyncWrite, Framed};
use actix_http::body::Body;
@ -7,8 +7,8 @@ use actix_http::client::{
Connect as ClientConnect, ConnectError, Connection, SendRequestError,
};
use actix_http::h1::ClientCodec;
use actix_http::{RequestHead, RequestHeadType, ResponseHead};
use actix_http::http::HeaderMap;
use actix_http::{RequestHead, RequestHeadType, ResponseHead};
use actix_service::Service;
use futures::{Future, Poll};
@ -82,7 +82,9 @@ where
})
.from_err()
// send request
.and_then(move |connection| connection.send_request(RequestHeadType::from(head), body))
.and_then(move |connection| {
connection.send_request(RequestHeadType::from(head), body)
})
.map(|(head, payload)| ClientResponse::new(head, payload)),
)
}
@ -103,7 +105,10 @@ where
})
.from_err()
// send request
.and_then(move |connection| connection.send_request(RequestHeadType::Rc(head, extra_headers), body))
.and_then(move |connection| {
connection
.send_request(RequestHeadType::Rc(head, extra_headers), body)
})
.map(|(head, payload)| ClientResponse::new(head, payload)),
)
}
@ -127,7 +132,9 @@ where
})
.from_err()
// send request
.and_then(move |connection| connection.open_tunnel(RequestHeadType::from(head)))
.and_then(move |connection| {
connection.open_tunnel(RequestHeadType::from(head))
})
.map(|(head, framed)| {
let framed = framed.map_io(|io| BoxedSocket(Box::new(Socket(io))));
(head, framed)
@ -155,7 +162,9 @@ where
})
.from_err()
// send request
.and_then(move |connection| connection.open_tunnel(RequestHeadType::Rc(head, extra_headers)))
.and_then(move |connection| {
connection.open_tunnel(RequestHeadType::Rc(head, extra_headers))
})
.map(|(head, framed)| {
let framed = framed.map_io(|io| BoxedSocket(Box::new(Socket(io))));
(head, framed)

View File

@ -1,5 +1,7 @@
//! Http client errors
pub use actix_http::client::{ConnectError, InvalidUrl, SendRequestError, FreezeRequestError};
pub use actix_http::client::{
ConnectError, FreezeRequestError, InvalidUrl, SendRequestError,
};
pub use actix_http::error::PayloadError;
pub use actix_http::ws::HandshakeError as WsHandshakeError;
pub use actix_http::ws::ProtocolError as WsProtocolError;

View File

@ -90,7 +90,7 @@ impl Future for SendClientRequest {
Ok(Async::Ready(res))
}
SendClientRequest::Err(ref mut e) => match e.take() {
Some(e) => Err(e.into()),
Some(e) => Err(e),
None => panic!("Attempting to call completed future"),
},
}
@ -153,7 +153,7 @@ impl RequestSender {
SendClientRequest::new(
fut,
response_decompress,
timeout.or_else(|| config.timeout.clone()),
timeout.or_else(|| config.timeout),
)
}

View File

@ -234,7 +234,10 @@ impl WebsocketsRequest {
}
if !self.head.headers.contains_key(header::HOST) {
self.head.headers.insert(header::HOST, HeaderValue::from_str(uri.host().unwrap()).unwrap());
self.head.headers.insert(
header::HOST,
HeaderValue::from_str(uri.host().unwrap()).unwrap(),
);
}
// set cookies