From 83296afc83542578a5f4eb287f61efb920f9865e Mon Sep 17 00:00:00 2001 From: Lewin Bormann Date: Thu, 4 Mar 2021 19:33:08 +0100 Subject: [PATCH] Run rustfmt on authenticator.rs --- src/authenticator.rs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/authenticator.rs b/src/authenticator.rs index 39d062b..6ad3086 100644 --- a/src/authenticator.rs +++ b/src/authenticator.rs @@ -26,7 +26,7 @@ struct InnerAuthenticator { /// and optionally persisting tokens to disk. #[derive(Clone)] pub struct Authenticator { - inner: Arc> + inner: Arc>, } struct DisplayScopes<'a, T>(&'a [T]); @@ -103,16 +103,29 @@ where Some(app_secret), ) => { // token is expired but has a refresh token. - let token_info = - RefreshFlow::refresh_token(&self.inner.hyper_client, app_secret, &refresh_token) - .await?; - self.inner.storage.set(hashed_scopes, token_info.clone()).await?; + let token_info = RefreshFlow::refresh_token( + &self.inner.hyper_client, + app_secret, + &refresh_token, + ) + .await?; + self.inner + .storage + .set(hashed_scopes, token_info.clone()) + .await?; Ok(token_info.into()) } _ => { // no token in the cache or the token returned can't be refreshed. - let token_info = self.inner.auth_flow.token(&self.inner.hyper_client, scopes).await?; - self.inner.storage.set(hashed_scopes, token_info.clone()).await?; + let token_info = self + .inner + .auth_flow + .token(&self.inner.hyper_client, scopes) + .await?; + self.inner + .storage + .set(hashed_scopes, token_info.clone()) + .await?; Ok(token_info.into()) } } @@ -227,11 +240,13 @@ impl AuthenticatorBuilder { StorageType::Disk(path) => Storage::Disk(storage::DiskStorage::new(path).await?), }; - Ok(Authenticator{ inner: Arc::new(InnerAuthenticator { - hyper_client, - storage, - auth_flow, - })}) + Ok(Authenticator { + inner: Arc::new(InnerAuthenticator { + hyper_client, + storage, + auth_flow, + }), + }) } fn with_auth_flow(auth_flow: F) -> AuthenticatorBuilder {