]> git.proxmox.com Git - proxmox.git/commitdiff
sys: cleanup assigned and immediately returned var
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 29 Nov 2023 13:57:18 +0000 (14:57 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 29 Nov 2023 13:57:29 +0000 (14:57 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
proxmox-sys/src/boot_mode.rs

index 390618cc8dba8713e6484ddee212dd683cd0e9fd..2746a1f988aa59686162aef1e246e253407c2fb5 100644 (file)
@@ -24,21 +24,20 @@ static SECURE_BOOT: OnceLock<SecureBoot> = OnceLock::new();
 impl BootMode {
     /// Returns the current bootmode (BIOS or EFI)
     pub fn query() -> BootMode {
-        let value: &BootMode = BOOT_MODE.get_or_init(|| {
+        *BOOT_MODE.get_or_init(|| {
             if std::path::Path::new("/sys/firmware/efi").exists() {
                 BootMode::Efi
             } else {
                 BootMode::Bios
             }
-        });
-        *value
+        })
     }
 }
 
 impl SecureBoot {
     /// Checks if secure boot is enabled
     pub fn query() -> SecureBoot {
-        let value: &SecureBoot = SECURE_BOOT.get_or_init(|| {
+        *SECURE_BOOT.get_or_init(|| {
             // Check if SecureBoot is enabled
             // Attention: this file is not seekable!
             // Spec: https://uefi.org/specs/UEFI/2.10/03_Boot_Manager.html?highlight=8be4d#globally-defined-variables
@@ -54,7 +53,6 @@ impl SecureBoot {
             } else {
                 SecureBoot::Disabled
             }
-        });
-        *value
+        })
     }
 }