Skip to content

Commit c877076

Browse files
cursoragentlovasoa
andcommitted
Fix lifetime annotations and remove unnecessary self references
Co-authored-by: contact <[email protected]>
1 parent fa201bd commit c877076

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/app_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ fn create_default_database(configuration_directory: &Path) -> String {
494494
}
495495

496496
#[cfg(any(test, not(feature = "lambda-web")))]
497-
fn encode_uri(path: &Path) -> std::borrow::Cow<str> {
497+
fn encode_uri(path: &Path) -> std::borrow::Cow<'_, str> {
498498
const ASCII_SET: &percent_encoding::AsciiSet = &percent_encoding::NON_ALPHANUMERIC
499499
.remove(b'-')
500500
.remove(b'_')

src/template_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ mod tests {
704704
}
705705
}
706706

707-
fn as_args(contents: &Value) -> [PathAndJson; 1] {
707+
fn as_args(contents: &Value) -> [PathAndJson<'_>; 1] {
708708
[as_helper_arg(CONTENT_KEY, contents)]
709709
}
710710

src/webserver/oidc.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,11 @@ where
254254
}
255255

256256
fn handle_authenticated_oidc_callback(
257-
&self,
258257
request: ServiceRequest,
259258
) -> LocalBoxFuture<Result<ServiceResponse<BoxBody>, Error>> {
260259
Box::pin(async move {
261260
log::debug!("Handling OIDC callback for already authenticated user");
262-
261+
263262
// Try to get the initial URL from the state cookie
264263
let redirect_url = match get_state_from_cookie(&request) {
265264
Ok(state) => {
@@ -271,7 +270,7 @@ where
271270
"/".to_string()
272271
}
273272
};
274-
273+
275274
let response = build_redirect_response(redirect_url);
276275
Ok(request.into_response(response))
277276
})
@@ -295,7 +294,7 @@ where
295294
// Handle OIDC callback URL even for authenticated users
296295
if request.path() == SQLPAGE_REDIRECT_URI {
297296
log::debug!("The request is the OIDC callback for an authenticated user");
298-
return self.handle_authenticated_oidc_callback(request);
297+
return Self::handle_authenticated_oidc_callback(request);
299298
}
300299

301300
let oidc_client = Arc::clone(&self.oidc_state.client);
@@ -680,7 +679,7 @@ impl OidcLoginState {
680679
}
681680
}
682681

683-
fn create_state_cookie(request: &ServiceRequest, auth_url: AuthUrlParams) -> Cookie {
682+
fn create_state_cookie(request: &ServiceRequest, auth_url: AuthUrlParams) -> Cookie<'_> {
684683
let state = OidcLoginState::new(request, auth_url);
685684
let state_json = serde_json::to_string(&state).unwrap();
686685
Cookie::build(SQLPAGE_STATE_COOKIE_NAME, state_json)

0 commit comments

Comments
 (0)