mirror of
https://gitlab.com/msrd0/gotham-restful.git
synced 2025-04-20 06:54:46 +00:00
apply some clippy suggestions
This commit is contained in:
parent
6ee382242b
commit
388bf8b49c
8 changed files with 23 additions and 8 deletions
|
@ -125,7 +125,7 @@ where
|
|||
type Err = Res::Err;
|
||||
|
||||
fn into_response(self) -> Pin<Box<dyn Future<Output = Result<Response, Self::Err>> + Send>> {
|
||||
self.then(|result| result.into_response()).boxed()
|
||||
self.then(ResourceResult::into_response).boxed()
|
||||
}
|
||||
|
||||
fn accepted_types() -> Option<Vec<Mime>> {
|
||||
|
|
|
@ -92,7 +92,7 @@ where
|
|||
type Err = SerdeJsonError; // just for easier handling of `Result<Raw<T>, E>`
|
||||
|
||||
fn into_response(self) -> Pin<Box<dyn Future<Output = Result<Response, SerdeJsonError>> + Send>> {
|
||||
future::ok(Response::new(StatusCode::OK, self.raw, Some(self.mime.clone()))).boxed()
|
||||
future::ok(Response::new(StatusCode::OK, self.raw, Some(self.mime))).boxed()
|
||||
}
|
||||
|
||||
#[cfg(feature = "openapi")]
|
||||
|
|
|
@ -71,7 +71,7 @@ mod test {
|
|||
let res = block_on(ok.into_response()).expect("didn't expect error response");
|
||||
assert_eq!(res.status, StatusCode::OK);
|
||||
assert_eq!(res.mime, Some(APPLICATION_JSON));
|
||||
assert_eq!(res.full_body().unwrap(), r#"{"msg":""}"#.as_bytes());
|
||||
assert_eq!(res.full_body().unwrap(), br#"{"msg":""}"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -129,7 +129,7 @@ mod test {
|
|||
let res = block_on(success.into_response()).expect("didn't expect error response");
|
||||
assert_eq!(res.status, StatusCode::OK);
|
||||
assert_eq!(res.mime, Some(APPLICATION_JSON));
|
||||
assert_eq!(res.full_body().unwrap(), r#"{"msg":""}"#.as_bytes());
|
||||
assert_eq!(res.full_body().unwrap(), br#"{"msg":""}"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue