clippy warns

This commit is contained in:
Nikolay Kim 2020-04-17 00:24:31 +06:00
parent 63cde53f22
commit 1dee624ccd
5 changed files with 22 additions and 23 deletions

View file

@ -521,6 +521,7 @@ mod tests {
}
#[test]
#[allow(clippy::let_unit_value, clippy::unit_cmp)]
fn test_request_extract() {
let mut path = Path::new("/name/user1/");
path.segments = vec![

View file

@ -327,7 +327,7 @@ mod tests {
let srv = pipeline(Srv1(cnt.clone())).and_then(Srv2(cnt));
let res = srv.call("srv1").await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv1", "srv2")));
assert_eq!(res.unwrap(), ("srv1", "srv2"));
}
#[ntex_rt::test]

View file

@ -305,17 +305,16 @@ mod tests {
Poll::Ready(Ok(()))
}
fn call(&self, req: Self::Request) -> Self::Future {
ok(req)
fn call(&self, _: Self::Request) -> Self::Future {
ok(())
}
}
#[ntex_rt::test]
async fn test_service() {
let srv = pipeline(|r: &'static str| ok(r))
.and_then_apply_fn(Srv, |req: &'static str, s| {
s.call(()).map_ok(move |res| (req, res))
});
let srv = pipeline(ok).and_then_apply_fn(Srv, |req: &'static str, s| {
s.call(()).map_ok(move |res| (req, res))
});
let res = lazy(|cx| srv.poll_ready(cx)).await;
assert_eq!(res, Poll::Ready(Ok(())));
@ -326,12 +325,11 @@ mod tests {
#[ntex_rt::test]
async fn test_service_factory() {
let new_srv =
pipeline_factory(|| ok::<_, ()>(fn_service(|r: &'static str| ok(r))))
.and_then_apply_fn(
|| ok(Srv),
|req: &'static str, s| s.call(()).map_ok(move |res| (req, res)),
);
let new_srv = pipeline_factory(|| ok::<_, ()>(fn_service(ok)))
.and_then_apply_fn(
|| ok(Srv),
|req: &'static str, s| s.call(()).map_ok(move |res| (req, res)),
);
let srv = new_srv.new_service(()).await.unwrap();
let res = lazy(|cx| srv.poll_ready(cx)).await;
assert_eq!(res, Poll::Ready(Ok(())));

View file

@ -243,8 +243,8 @@ mod tests {
let srv = pipeline(apply_fn(Srv, |req: &'static str, srv| {
let fut = srv.call(());
async move {
let res = fut.await.unwrap();
Ok((req, res))
fut.await.unwrap();
Ok((req, ()))
}
}));
@ -252,7 +252,7 @@ mod tests {
let res = srv.call("srv").await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv", ())));
assert_eq!(res.unwrap(), ("srv", ()));
}
#[ntex_rt::test]
@ -262,8 +262,8 @@ mod tests {
|req: &'static str, srv| {
let fut = srv.call(());
async move {
let res = fut.await.unwrap();
Ok((req, res))
fut.await.unwrap();
Ok((req, ()))
}
},
));
@ -274,6 +274,6 @@ mod tests {
let res = srv.call("srv").await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv", ())));
assert_eq!(res.unwrap(), ("srv", ()));
}
}

View file

@ -321,11 +321,11 @@ mod tests {
let res = srv.call(Ok("srv1")).await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv1", "ok")));
assert_eq!(res.unwrap(), ("srv1", "ok"));
let res = srv.call(Err("srv")).await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv2", "err")));
assert_eq!(res.unwrap(), ("srv2", "err"));
}
#[ntex_rt::test]
@ -337,10 +337,10 @@ mod tests {
let srv = factory.new_service(&()).await.unwrap();
let res = srv.call(Ok("srv1")).await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv1", "ok")));
assert_eq!(res.unwrap(), ("srv1", "ok"));
let res = srv.call(Err("srv")).await;
assert!(res.is_ok());
assert_eq!(res.unwrap(), (("srv2", "err")));
assert_eq!(res.unwrap(), ("srv2", "err"));
}
}