Merge pull request #344 from Fishrock123/fix-clippy-lints

lints: fix clippy lints
This commit is contained in:
Jeremiah Senkpiel 2022-05-09 17:49:46 -07:00 committed by GitHub
commit de0e5e5eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -238,7 +238,7 @@ impl Client {
/// ```
pub async fn recv_bytes(&self, req: impl Into<Request>) -> Result<Vec<u8>> {
let mut res = self.send(req.into()).await?;
Ok(res.body_bytes().await?)
res.body_bytes().await
}
/// Submit a `Request` and get the response body as a string.
@ -255,7 +255,7 @@ impl Client {
/// ```
pub async fn recv_string(&self, req: impl Into<Request>) -> Result<String> {
let mut res = self.send(req.into()).await?;
Ok(res.body_string().await?)
res.body_string().await
}
/// Submit a `Request` and decode the response body from json into a struct.
@ -281,7 +281,7 @@ impl Client {
req: impl Into<Request>,
) -> Result<T> {
let mut res = self.send(req.into()).await?;
Ok(res.body_json::<T>().await?)
res.body_json::<T>().await
}
/// Submit a `Request` and decode the response body from form encoding into a struct.
@ -314,7 +314,7 @@ impl Client {
req: impl Into<Request>,
) -> Result<T> {
let mut res = self.send(req.into()).await?;
Ok(res.body_form::<T>().await?)
res.body_form::<T>().await
}
/// Perform an HTTP `GET` request using the `Client` connection.

View File

@ -287,7 +287,7 @@ impl RequestBuilder {
/// ```
pub async fn recv_bytes(self) -> Result<Vec<u8>> {
let mut res = self.send().await?;
Ok(res.body_bytes().await?)
res.body_bytes().await
}
/// Submit the request and get the response body as a string.
@ -303,7 +303,7 @@ impl RequestBuilder {
/// ```
pub async fn recv_string(self) -> Result<String> {
let mut res = self.send().await?;
Ok(res.body_string().await?)
res.body_string().await
}
/// Submit the request and decode the response body from json into a struct.
@ -326,7 +326,7 @@ impl RequestBuilder {
/// ```
pub async fn recv_json<T: serde::de::DeserializeOwned>(self) -> Result<T> {
let mut res = self.send().await?;
Ok(res.body_json::<T>().await?)
res.body_json::<T>().await
}
/// Submit the request and decode the response body from form encoding into a struct.
@ -356,7 +356,7 @@ impl RequestBuilder {
/// ```
pub async fn recv_form<T: serde::de::DeserializeOwned>(self) -> Result<T> {
let mut res = self.send().await?;
Ok(res.body_form::<T>().await?)
res.body_form::<T>().await
}
/// Push middleware onto a per-request middleware stack.

View File

@ -283,7 +283,7 @@ impl Response {
/// ```
pub async fn body_json<T: DeserializeOwned>(&mut self) -> crate::Result<T> {
let body_bytes = self.body_bytes().await?;
Ok(serde_json::from_slice(&body_bytes).map_err(crate::Error::from)?)
serde_json::from_slice(&body_bytes).map_err(crate::Error::from)
}
/// Reads and deserialized the entire request body from form encoding.