Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cottinisimone committed Mar 11, 2024
1 parent 7b0b3e3 commit 310225f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/auth0/token.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use chrono::{DateTime, Duration, Utc};
use chrono::{DateTime, Utc};
use reqwest::{Client, Response};
use serde::{Deserialize, Serialize};
use std::time::Duration;

use crate::auth0::errors::Auth0Error;
use crate::auth0::Config;
Expand Down Expand Up @@ -54,8 +55,7 @@ impl Token {
// the exact issued_at (iat) and expiration (exp)
// reference: https://www.iana.org/assignments/jwt/jwt.xhtml
let issue_date: DateTime<Utc> = Utc::now();
let expire_date: DateTime<Utc> =
Utc::now() + Duration::try_seconds(response.expires_in as i64).unwrap_or(Duration::max_value());
let expire_date: DateTime<Utc> = Utc::now() + Duration::from_secs(response.expires_in as u64);

Ok(Self {
token: access_token,
Expand Down
7 changes: 3 additions & 4 deletions src/request/request_type/graphql.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::{HashMap, VecDeque};

use std::time::Duration;

use async_trait::async_trait;
Expand Down Expand Up @@ -43,7 +42,7 @@ impl<'a, Client: BridgeClient> GraphQLRequest<'a, Client> {
Ok(Self {
id: Uuid::new_v4(),
bridge,
body: Body::from(serde_json::to_string(&graphql_body.into())?),
body: serde_json::to_string(&graphql_body.into())?.into(),
method: Method::POST,
path: Default::default(),
timeout: Duration::from_secs(60),
Expand Down Expand Up @@ -81,7 +80,7 @@ impl<'a, Client: BridgeClient> GraphQLRequest<'a, Client> {
Ok(Self {
id: Uuid::new_v4(),
bridge,
body: Body::from(serde_json::to_string(&body_with_injected_variables)?),
body: serde_json::to_string(&body_with_injected_variables)?.into(),
method: Method::POST,
path: Default::default(),
timeout: Duration::from_secs(60),
Expand All @@ -105,7 +104,7 @@ impl<'a, Client: BridgeClient> DeliverableRequest<'a> for GraphQLRequest<'a, Cli

fn json_body<B: Serialize>(self, body: &B) -> PrimaBridgeResult<Self> {
Ok(Self {
body: Body::from(serde_json::to_string(body)?),
body: serde_json::to_string(body)?.into(),
..self
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/request/request_type/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'a, Client: BridgeClient> DeliverableRequest<'a> for RestRequest<'a, Client
let mut custom_headers = self.custom_headers;
custom_headers.append(CONTENT_TYPE, HeaderValue::from_static("application/json"));
Ok(Self {
body: Some(Body::from(serde_json::to_string(body)?)),
body: Some(serde_json::to_string(body)?.into()),
custom_headers,
..self
})
Expand Down

0 comments on commit 310225f

Please sign in to comment.