mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-03 21:07:39 +03:00
clippy warns
This commit is contained in:
parent
63cde53f22
commit
1dee624ccd
5 changed files with 22 additions and 23 deletions
|
@ -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]
|
||||
|
|
|
@ -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(())));
|
||||
|
|
|
@ -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", ()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue