[pve-devel] [PATCH installer 3/3] tui: remove obsolete, global `SetupInfo` state

Christoph Heiss c.heiss at proxmox.com
Wed Oct 4 18:00:57 CEST 2023


No functional changes.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxmox-tui-installer/src/main.rs | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index ea8c8d9..49f378b 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -1,3 +1,5 @@
+#![forbid(unsafe_code)]
+
 use std::{
     collections::HashMap,
     env,
@@ -50,24 +52,6 @@ const PROXMOX_LOGO: &str = r#"
 |  __/| | | (_) >  <| | | | | | (_) >  <
 |_|   |_|  \___/_/\_\_| |_| |_|\___/_/\_\ "#;

-/// ISO information is available globally.
-static mut SETUP_INFO: Option<SetupInfo> = None;
-
-pub fn setup_info() -> &'static SetupInfo {
-    unsafe { SETUP_INFO.as_ref().unwrap() }
-}
-
-fn init_setup_info(info: SetupInfo) {
-    unsafe {
-        SETUP_INFO = Some(info);
-    }
-}
-
-#[inline]
-pub fn current_product() -> setup::ProxmoxProduct {
-    setup_info().config.product
-}
-
 struct InstallerView {
     view: ResizedView<Dialog>,
 }
@@ -223,7 +207,6 @@ fn installer_setup(in_test_mode: bool) -> Result<(SetupInfo, LocaleInfo, Runtime

         setup::read_json(&path).map_err(|err| format!("Failed to retrieve setup info: {err}"))?
     };
-    init_setup_info(installer_info.clone());

     let locale_info = {
         let mut path = path.clone();
--
2.42.0






More information about the pve-devel mailing list