Skip to content

Commit e18d03f

Browse files
committed
clippy fixes
- Changed http_client from Arc to Rc in OidcService for improved memory efficiency. - Updated related code to reflect the new ownership model for the HTTP client.
1 parent 5ad010b commit e18d03f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/webserver/oidc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{future::Future, pin::Pin, str::FromStr, sync::Arc};
1+
use std::{future::Future, pin::Pin, rc::Rc, str::FromStr, sync::Arc};
22

33
use crate::{app_config::AppConfig, AppState};
44
use actix_web::{
@@ -161,7 +161,7 @@ pub struct OidcService<S> {
161161
service: S,
162162
config: Arc<OidcConfig>,
163163
oidc_client: Arc<OidcClient>,
164-
http_client: Arc<AwcHttpClient>,
164+
http_client: Rc<AwcHttpClient>,
165165
}
166166

167167
impl<S> OidcService<S> {
@@ -179,7 +179,7 @@ impl<S> OidcService<S> {
179179
service,
180180
config,
181181
oidc_client: Arc::new(client),
182-
http_client: Arc::new(http_client),
182+
http_client: Rc::new(http_client),
183183
})
184184
}
185185

@@ -205,7 +205,7 @@ impl<S> OidcService<S> {
205205
request: ServiceRequest,
206206
) -> LocalBoxFuture<Result<ServiceResponse<BoxBody>, Error>> {
207207
let oidc_client = Arc::clone(&self.oidc_client);
208-
let http_client = Arc::clone(&self.http_client);
208+
let http_client = Rc::clone(&self.http_client);
209209
let oidc_config = Arc::clone(&self.config);
210210

211211
Box::pin(async move {
@@ -268,8 +268,8 @@ where
268268
}
269269

270270
async fn process_oidc_callback(
271-
oidc_client: &Arc<OidcClient>,
272-
http_client: &Arc<AwcHttpClient>,
271+
oidc_client: &OidcClient,
272+
http_client: &AwcHttpClient,
273273
query_string: &str,
274274
request: &ServiceRequest,
275275
) -> anyhow::Result<HttpResponse> {
@@ -398,7 +398,7 @@ impl<'c> AsyncHttpClient<'c> for AwcHttpClient {
398398
Box::pin(async move {
399399
execute_oidc_request_with_awc(client, request)
400400
.await
401-
.map_err(|err| AwcWrapperError(err))
401+
.map_err(AwcWrapperError)
402402
})
403403
}
404404
}

0 commit comments

Comments
 (0)