From f44a1942d9ae12a96f834da2d89fc1cbd83ee75e Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Tue, 3 Sep 2024 12:30:40 +0200 Subject: [PATCH] Reduce MSRV before this commit the repo cannot be build with rust 1.77 which is pretty recent --- src/main.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6392b1d..748459e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -51,16 +51,12 @@ struct SecurityAddon; impl Modify for SecurityAddon { fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) { - let updated_component = if let Some(components) = openapi.components.as_mut() { - components - } else { - &mut Components::new() - }; - updated_component.add_security_scheme( + let components = openapi.components.get_or_insert_with(Components::new); + components.add_security_scheme( "api_key", SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::new("rune"))), ); - openapi.components = Some(updated_component.clone()) + openapi.components = Some(components.clone()) } }