Fix clippy lints

This commit is contained in:
Maxime Augier 2024-08-02 11:45:52 +02:00
parent a02ac05443
commit b731f182be

View File

@ -13,7 +13,7 @@ pub struct Context {
token_expiration: Instant, token_expiration: Instant,
} }
const API_BASE: &'static str = "https://api.easee.com/api/"; const API_BASE: &str = "https://api.easee.com/api/";
const REFRESH_TOKEN_DELAY: Duration = Duration::from_secs(600); const REFRESH_TOKEN_DELAY: Duration = Duration::from_secs(600);
#[derive(Clone,Copy,Debug,Eq,Ord,PartialEq,PartialOrd)] #[derive(Clone,Copy,Debug,Eq,Ord,PartialEq,PartialOrd)]
@ -280,7 +280,7 @@ impl Context {
let url = format!("{}accounts/refresh_token", API_BASE); let url = format!("{}accounts/refresh_token", API_BASE);
let resp: LoginResponse = ureq::post(&url) let resp: LoginResponse = ureq::post(&url)
.set("Content-type", "application/json") .set("Content-type", "application/json")
.send_json(&params)? .send_json(params)?
.into_json_with_error()?; .into_json_with_error()?;
*self = Self::from_login_response(resp); *self = Self::from_login_response(resp);
@ -313,7 +313,7 @@ impl Context {
resp = req.call()? resp = req.call()?
} }
Ok(resp.into_json_with_error()?) resp.into_json_with_error()
} }
fn maybe_get<T: DeserializeOwned>(&mut self, path: &str) -> Result<Option<T>, ApiError> { fn maybe_get<T: DeserializeOwned>(&mut self, path: &str) -> Result<Option<T>, ApiError> {
@ -341,7 +341,7 @@ impl Context {
resp = req.send_json(params)? resp = req.send_json(params)?
} }
Ok(resp.into_json_with_error()?) resp.into_json_with_error()
} }
} }