Run rustfmt

This commit is contained in:
Koen Bolhuis 2021-09-01 18:14:04 +02:00
parent c49f40128d
commit c1bb3f39f4
2 changed files with 26 additions and 16 deletions

View File

@ -109,9 +109,7 @@ impl Client {
pub fn validate_token(&self, token: &str) -> Result<ValidateTokenResponse, Error> {
let endpoint = format!("{}{}", self.api_root_url, Endpoint::ValidateToken);
let response = attohttpc::get(endpoint)
.param("token", token)
.send()?;
let response = attohttpc::get(endpoint).param("token", token).send()?;
ResponseType::from_response(response)
}

View File

@ -6,9 +6,9 @@
use std::collections::HashMap;
use attohttpc::Response;
use serde::de::DeserializeOwned;
use serde::Deserialize;
use attohttpc::Response;
use crate::Error;
@ -33,18 +33,30 @@ impl RateLimit {
fn from_headers(response: &Response) -> Option<Self> {
let headers = response.headers();
let limit = headers.get("X-RateLimit-Limit")?
.to_str().ok()?
.parse().ok()?;
let remaining = headers.get("X-RateLimit-Remaining")?
.to_str().ok()?
.parse().ok()?;
let reset_in = headers.get("X-RateLimit-Reset-In")?
.to_str().ok()?
.parse().ok()?;
let reset = headers.get("X-RateLimit-Reset")?
.to_str().ok()?
.parse().ok()?;
let limit = headers
.get("X-RateLimit-Limit")?
.to_str()
.ok()?
.parse()
.ok()?;
let remaining = headers
.get("X-RateLimit-Remaining")?
.to_str()
.ok()?
.parse()
.ok()?;
let reset_in = headers
.get("X-RateLimit-Reset-In")?
.to_str()
.ok()?
.parse()
.ok()?;
let reset = headers
.get("X-RateLimit-Reset")?
.to_str()
.ok()?
.parse()
.ok()?;
Some(Self {
limit,