From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer v2 3/3] tui: remove obsolete, global `SetupInfo` state
Date: Wed, 25 Oct 2023 10:56:24 +0200 [thread overview]
Message-ID: <20231025085634.171618-4-c.heiss@proxmox.com> (raw)
In-Reply-To: <20231025085634.171618-1-c.heiss@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@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 a342a08..81fe3ca 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
next prev parent reply other threads:[~2023-10-25 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 8:56 [pve-devel] [PATCH installer v2 0/3] tui: remove global, unsafe setup info Christoph Heiss
2023-10-25 8:56 ` [pve-devel] [PATCH installer v2 1/3] tui: refactor `NetworkOptions` to have a `defaults_from()` function Christoph Heiss
2023-10-25 8:56 ` [pve-devel] [PATCH installer v2 2/3] tui: bootdisk: pass down product info to advanced dialog Christoph Heiss
2023-10-25 8:56 ` Christoph Heiss [this message]
2023-10-25 17:04 ` [pve-devel] applied-series: [PATCH installer v2 0/3] tui: remove global, unsafe setup info Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231025085634.171618-4-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.