1
0
Fork 0
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:
Dominic 2021-01-01 18:03:31 +01:00
parent 6ee382242b
commit 388bf8b49c
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
8 changed files with 23 additions and 8 deletions

View file

@ -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>> {

View file

@ -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")]

View file

@ -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]

View file

@ -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]