mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-30 18:42:52 +01:00
fix warnings
This commit is contained in:
parent
d6abd2fe22
commit
85b275bb2b
@ -56,7 +56,7 @@ base64 = "0.9"
|
|||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
h2 = "0.1"
|
h2 = "0.1"
|
||||||
htmlescape = "0.3"
|
htmlescape = "0.3"
|
||||||
http = "^0.1.5"
|
http = "^0.1.8"
|
||||||
httparse = "1.3"
|
httparse = "1.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mime = "0.3"
|
mime = "0.3"
|
||||||
|
@ -599,7 +599,7 @@ impl ClientConnector {
|
|||||||
}
|
}
|
||||||
Acquire::Available => {
|
Acquire::Available => {
|
||||||
// create new connection
|
// create new connection
|
||||||
self.connect_waiter(key.clone(), waiter, ctx);
|
self.connect_waiter(&key, waiter, ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,7 +608,7 @@ impl ClientConnector {
|
|||||||
self.waiters = Some(act_waiters);
|
self.waiters = Some(act_waiters);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn connect_waiter(&mut self, key: Key, waiter: Waiter, ctx: &mut Context<Self>) {
|
fn connect_waiter(&mut self, key: &Key, waiter: Waiter, ctx: &mut Context<Self>) {
|
||||||
let conn = AcquiredConn(key.clone(), Some(self.acq_tx.clone()));
|
let conn = AcquiredConn(key.clone(), Some(self.acq_tx.clone()));
|
||||||
|
|
||||||
let key2 = key.clone();
|
let key2 = key.clone();
|
||||||
@ -828,7 +828,7 @@ impl Handler<Connect> for ClientConnector {
|
|||||||
wait,
|
wait,
|
||||||
conn_timeout,
|
conn_timeout,
|
||||||
};
|
};
|
||||||
self.connect_waiter(key.clone(), waiter, ctx);
|
self.connect_waiter(&key, waiter, ctx);
|
||||||
|
|
||||||
return ActorResponse::async(
|
return ActorResponse::async(
|
||||||
rx.map_err(|_| ClientConnectorError::Disconnected)
|
rx.map_err(|_| ClientConnectorError::Disconnected)
|
||||||
@ -885,7 +885,7 @@ impl Handler<Connect> for ClientConnector {
|
|||||||
wait,
|
wait,
|
||||||
conn_timeout,
|
conn_timeout,
|
||||||
};
|
};
|
||||||
self.connect_waiter(key.clone(), waiter, ctx);
|
self.connect_waiter(&key, waiter, ctx);
|
||||||
|
|
||||||
ActorResponse::async(
|
ActorResponse::async(
|
||||||
rx.map_err(|_| ClientConnectorError::Disconnected)
|
rx.map_err(|_| ClientConnectorError::Disconnected)
|
||||||
|
@ -216,7 +216,7 @@ impl Future for SendRequest {
|
|||||||
|
|
||||||
match pl.parse() {
|
match pl.parse() {
|
||||||
Ok(Async::Ready(mut resp)) => {
|
Ok(Async::Ready(mut resp)) => {
|
||||||
if self.req.method() == &Method::HEAD {
|
if self.req.method() == Method::HEAD {
|
||||||
pl.parser.take();
|
pl.parser.take();
|
||||||
}
|
}
|
||||||
resp.set_pipeline(pl);
|
resp.set_pipeline(pl);
|
||||||
|
@ -6,7 +6,7 @@ use std::{fmt, str};
|
|||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use encoding::all::UTF_8;
|
use encoding::all::UTF_8;
|
||||||
use encoding::types::{DecoderTrap, Encoding};
|
use encoding::types::{DecoderTrap, Encoding};
|
||||||
use futures::{Async, Future, Poll, future};
|
use futures::{future, Async, Future, Poll};
|
||||||
use mime::Mime;
|
use mime::Mime;
|
||||||
use serde::de::{self, DeserializeOwned};
|
use serde::de::{self, DeserializeOwned};
|
||||||
use serde_urlencoded;
|
use serde_urlencoded;
|
||||||
@ -504,19 +504,18 @@ impl<S: 'static> FromRequest<S> for String {
|
|||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
impl<T: 'static, S: 'static> FromRequest<S> for Option<T> where T: FromRequest<S> {
|
impl<T: 'static, S: 'static> FromRequest<S> for Option<T>
|
||||||
|
where
|
||||||
|
T: FromRequest<S>,
|
||||||
|
{
|
||||||
type Config = T::Config;
|
type Config = T::Config;
|
||||||
type Result = Box<Future<Item = Option<T>, Error = Error>>;
|
type Result = Box<Future<Item = Option<T>, Error = Error>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_request(req: &HttpRequest<S>, cfg: &Self::Config) -> Self::Result {
|
fn from_request(req: &HttpRequest<S>, cfg: &Self::Config) -> Self::Result {
|
||||||
Box::new(T::from_request(req, cfg).into().then( |r| {
|
Box::new(T::from_request(req, cfg).into().then(|r| match r {
|
||||||
match r {
|
|
||||||
Ok(v) => future::ok(Some(v)),
|
Ok(v) => future::ok(Some(v)),
|
||||||
Err(e) => {
|
Err(_) => future::ok(None),
|
||||||
future::ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,13 +565,16 @@ impl<T: 'static, S: 'static> FromRequest<S> for Option<T> where T: FromRequest<S
|
|||||||
/// });
|
/// });
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
impl<T: 'static, S: 'static> FromRequest<S> for Result<T, Error> where T: FromRequest<S>{
|
impl<T: 'static, S: 'static> FromRequest<S> for Result<T, Error>
|
||||||
|
where
|
||||||
|
T: FromRequest<S>,
|
||||||
|
{
|
||||||
type Config = T::Config;
|
type Config = T::Config;
|
||||||
type Result = Box<Future<Item = Result<T, Error>, Error = Error>>;
|
type Result = Box<Future<Item = Result<T, Error>, Error = Error>>;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn from_request(req: &HttpRequest<S>, cfg: &Self::Config) -> Self::Result {
|
fn from_request(req: &HttpRequest<S>, cfg: &Self::Config) -> Self::Result {
|
||||||
Box::new(T::from_request(req, cfg).into().then( |r| { future::ok(r) }))
|
Box::new(T::from_request(req, cfg).into().then(future::ok))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,7 +813,10 @@ mod tests {
|
|||||||
let mut cfg = FormConfig::default();
|
let mut cfg = FormConfig::default();
|
||||||
cfg.limit(4096);
|
cfg.limit(4096);
|
||||||
|
|
||||||
match Option::<Form<Info>>::from_request(&req, &cfg).poll().unwrap() {
|
match Option::<Form<Info>>::from_request(&req, &cfg)
|
||||||
|
.poll()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
Async::Ready(r) => assert_eq!(r, None),
|
Async::Ready(r) => assert_eq!(r, None),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
@ -823,8 +828,16 @@ mod tests {
|
|||||||
.set_payload(Bytes::from_static(b"hello=world"))
|
.set_payload(Bytes::from_static(b"hello=world"))
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
match Option::<Form<Info>>::from_request(&req, &cfg).poll().unwrap() {
|
match Option::<Form<Info>>::from_request(&req, &cfg)
|
||||||
Async::Ready(r) => assert_eq!(r, Some(Form(Info { hello: "world".into() }))),
|
.poll()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
|
Async::Ready(r) => assert_eq!(
|
||||||
|
r,
|
||||||
|
Some(Form(Info {
|
||||||
|
hello: "world".into()
|
||||||
|
}))
|
||||||
|
),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +848,10 @@ mod tests {
|
|||||||
.set_payload(Bytes::from_static(b"bye=world"))
|
.set_payload(Bytes::from_static(b"bye=world"))
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
match Option::<Form<Info>>::from_request(&req, &cfg).poll().unwrap() {
|
match Option::<Form<Info>>::from_request(&req, &cfg)
|
||||||
|
.poll()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
Async::Ready(r) => assert_eq!(r, None),
|
Async::Ready(r) => assert_eq!(r, None),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
@ -850,8 +866,16 @@ mod tests {
|
|||||||
.set_payload(Bytes::from_static(b"hello=world"))
|
.set_payload(Bytes::from_static(b"hello=world"))
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
match Result::<Form<Info>, Error>::from_request(&req, &FormConfig::default()).poll().unwrap() {
|
match Result::<Form<Info>, Error>::from_request(&req, &FormConfig::default())
|
||||||
Async::Ready(Ok(r)) => assert_eq!(r, Form(Info { hello: "world".into() })),
|
.poll()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
|
Async::Ready(Ok(r)) => assert_eq!(
|
||||||
|
r,
|
||||||
|
Form(Info {
|
||||||
|
hello: "world".into()
|
||||||
|
})
|
||||||
|
),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,14 +886,15 @@ mod tests {
|
|||||||
.set_payload(Bytes::from_static(b"bye=world"))
|
.set_payload(Bytes::from_static(b"bye=world"))
|
||||||
.finish();
|
.finish();
|
||||||
|
|
||||||
match Result::<Form<Info>, Error>::from_request(&req, &FormConfig::default()).poll().unwrap() {
|
match Result::<Form<Info>, Error>::from_request(&req, &FormConfig::default())
|
||||||
|
.poll()
|
||||||
|
.unwrap()
|
||||||
|
{
|
||||||
Async::Ready(r) => assert!(r.is_err()),
|
Async::Ready(r) => assert!(r.is_err()),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_payload_config() {
|
fn test_payload_config() {
|
||||||
let req = TestRequest::default().finish();
|
let req = TestRequest::default().finish();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user