* [pve-devel] [PATCH installer 0/2] update to 2024 edition, run cargo fmt
@ 2025-02-28 9:27 Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 1/2] tree-wide: rust: update to 2024 edition Christoph Heiss
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-02-28 9:27 UTC (permalink / raw)
To: pve-devel
As it says on the tin. First updates (and unifies) the edition across the
workspace to 2024, afterwards let `cargo fmt` rip through.
Christoph Heiss (2):
tree-wide: rust: update to 2024 edition
tree-wide: rust: run cargo fmt
Cargo.toml | 1 +
proxmox-auto-install-assistant/Cargo.toml | 2 +-
proxmox-auto-install-assistant/src/main.rs | 12 +++++++-----
proxmox-auto-installer/Cargo.toml | 2 +-
proxmox-auto-installer/src/answer.rs | 6 +++---
.../src/bin/proxmox-auto-installer.rs | 11 +++++------
proxmox-auto-installer/src/log.rs | 2 +-
proxmox-auto-installer/src/sysinfo.rs | 4 ++--
proxmox-auto-installer/src/utils.rs | 18 ++++++++++++------
proxmox-auto-installer/tests/parse-answer.rs | 2 +-
proxmox-chroot/Cargo.toml | 2 +-
proxmox-chroot/src/main.rs | 14 +++++++++-----
proxmox-fetch-answer/Cargo.toml | 2 +-
proxmox-fetch-answer/src/fetch_plugins/http.rs | 2 +-
.../src/fetch_plugins/partition.rs | 2 +-
proxmox-fetch-answer/src/main.rs | 4 ++--
proxmox-installer-common/Cargo.toml | 2 +-
proxmox-installer-common/src/options.rs | 2 +-
proxmox-installer-common/src/setup.rs | 2 +-
proxmox-installer-common/src/sysinfo.rs | 2 +-
proxmox-installer-common/src/utils.rs | 6 +-----
proxmox-post-hook/Cargo.toml | 2 +-
proxmox-post-hook/src/main.rs | 6 +++---
proxmox-tui-installer/Cargo.toml | 2 +-
proxmox-tui-installer/src/main.rs | 8 ++++----
proxmox-tui-installer/src/options.rs | 4 ++--
proxmox-tui-installer/src/views/bootdisk.rs | 10 +++++-----
.../src/views/install_progress.rs | 6 +++---
proxmox-tui-installer/src/views/mod.rs | 2 +-
proxmox-tui-installer/src/views/tabbed_view.rs | 2 +-
proxmox-tui-installer/src/views/table_view.rs | 4 ++--
proxmox-tui-installer/src/views/timezone.rs | 4 ++--
rustfmt.toml | 2 +-
33 files changed, 80 insertions(+), 72 deletions(-)
--
2.47.1
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH installer 1/2] tree-wide: rust: update to 2024 edition
2025-02-28 9:27 [pve-devel] [PATCH installer 0/2] update to 2024 edition, run cargo fmt Christoph Heiss
@ 2025-02-28 9:27 ` Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 2/2] tree-wide: rust: run cargo fmt Christoph Heiss
2025-02-28 15:05 ` [pve-devel] applied-series: [PATCH installer 0/2] update to 2024 edition, " Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-02-28 9:27 UTC (permalink / raw)
To: pve-devel
Updates (and unifies) the edition across the workspace to 2024.
No functional changes.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Cargo.toml | 1 +
proxmox-auto-install-assistant/Cargo.toml | 2 +-
proxmox-auto-installer/Cargo.toml | 2 +-
proxmox-chroot/Cargo.toml | 2 +-
proxmox-fetch-answer/Cargo.toml | 2 +-
proxmox-installer-common/Cargo.toml | 2 +-
proxmox-post-hook/Cargo.toml | 2 +-
proxmox-tui-installer/Cargo.toml | 2 +-
rustfmt.toml | 2 +-
9 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 99b5425..6c8d209 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,6 +12,7 @@ members = [
[workspace.package]
version = "8.3.4"
+edition = "2024"
[workspace.dependencies]
anyhow = "1.0"
diff --git a/proxmox-auto-install-assistant/Cargo.toml b/proxmox-auto-install-assistant/Cargo.toml
index c5d7b00..43a968f 100644
--- a/proxmox-auto-install-assistant/Cargo.toml
+++ b/proxmox-auto-install-assistant/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-auto-install-assistant"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [
"Aaron Lauterer <a.lauterer@proxmox.com>",
"Proxmox Support Team <support@proxmox.com>",
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 8940b57..221d5d2 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-auto-installer"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [
"Aaron Lauterer <a.lauterer@proxmox.com>",
"Proxmox Support Team <support@proxmox.com>",
diff --git a/proxmox-chroot/Cargo.toml b/proxmox-chroot/Cargo.toml
index eab945b..a23f757 100644
--- a/proxmox-chroot/Cargo.toml
+++ b/proxmox-chroot/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-chroot"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [ "Aaron Lauterer <a.lauterer@proxmox.com>" ]
license = "AGPL-3"
exclude = [ "build", "debian" ]
diff --git a/proxmox-fetch-answer/Cargo.toml b/proxmox-fetch-answer/Cargo.toml
index e610807..d779ad4 100644
--- a/proxmox-fetch-answer/Cargo.toml
+++ b/proxmox-fetch-answer/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-fetch-answer"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [
"Aaron Lauterer <a.lauterer@proxmox.com>",
"Proxmox Support Team <support@proxmox.com>",
diff --git a/proxmox-installer-common/Cargo.toml b/proxmox-installer-common/Cargo.toml
index 80b3534..c220f01 100644
--- a/proxmox-installer-common/Cargo.toml
+++ b/proxmox-installer-common/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-installer-common"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [ "Aaron Lauterer <a.lauterer@proxmox.com>" ]
license = "AGPL-3"
exclude = [ "build", "debian" ]
diff --git a/proxmox-post-hook/Cargo.toml b/proxmox-post-hook/Cargo.toml
index acf7f9b..1917f38 100644
--- a/proxmox-post-hook/Cargo.toml
+++ b/proxmox-post-hook/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-post-hook"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [
"Christoph Heiss <c.heiss@proxmox.com>",
"Proxmox Support Team <support@proxmox.com>",
diff --git a/proxmox-tui-installer/Cargo.toml b/proxmox-tui-installer/Cargo.toml
index 1f04ce0..0e9c940 100644
--- a/proxmox-tui-installer/Cargo.toml
+++ b/proxmox-tui-installer/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "proxmox-tui-installer"
version.workspace = true
-edition = "2021"
+edition.workspace = true
authors = [ "Christoph Heiss <c.heiss@proxmox.com>" ]
license = "AGPL-3"
exclude = [ "build", "debian" ]
diff --git a/rustfmt.toml b/rustfmt.toml
index 3a26366..f216078 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1 +1 @@
-edition = "2021"
+edition = "2024"
--
2.47.1
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] [PATCH installer 2/2] tree-wide: rust: run cargo fmt
2025-02-28 9:27 [pve-devel] [PATCH installer 0/2] update to 2024 edition, run cargo fmt Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 1/2] tree-wide: rust: update to 2024 edition Christoph Heiss
@ 2025-02-28 9:27 ` Christoph Heiss
2025-02-28 15:05 ` [pve-devel] applied-series: [PATCH installer 0/2] update to 2024 edition, " Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-02-28 9:27 UTC (permalink / raw)
To: pve-devel
The 2024 style guide changed some things, which causes quite some churn. Most of
boils down to the changed import order, now choosing types before function
items - which is the other way round then before.
No functional changes.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
We could set `style_guide = 2021` (see [0]) in `rustfmt.toml` if we wanted to
preserve the old style. I'd prefer to just do it once and go along, but no hard
feelings there.
[0] https://doc.rust-lang.org/nightly/edition-guide/rust-2024/rustfmt-style-edition.html
proxmox-auto-install-assistant/src/main.rs | 12 +++++++-----
proxmox-auto-installer/src/answer.rs | 6 +++---
.../src/bin/proxmox-auto-installer.rs | 11 +++++------
proxmox-auto-installer/src/log.rs | 2 +-
proxmox-auto-installer/src/sysinfo.rs | 4 ++--
proxmox-auto-installer/src/utils.rs | 18 ++++++++++++------
proxmox-auto-installer/tests/parse-answer.rs | 2 +-
proxmox-chroot/src/main.rs | 14 +++++++++-----
proxmox-fetch-answer/src/fetch_plugins/http.rs | 2 +-
.../src/fetch_plugins/partition.rs | 2 +-
proxmox-fetch-answer/src/main.rs | 4 ++--
proxmox-installer-common/src/options.rs | 2 +-
proxmox-installer-common/src/setup.rs | 2 +-
proxmox-installer-common/src/sysinfo.rs | 2 +-
proxmox-installer-common/src/utils.rs | 6 +-----
proxmox-post-hook/src/main.rs | 6 +++---
proxmox-tui-installer/src/main.rs | 8 ++++----
proxmox-tui-installer/src/options.rs | 4 ++--
proxmox-tui-installer/src/views/bootdisk.rs | 10 +++++-----
.../src/views/install_progress.rs | 6 +++---
proxmox-tui-installer/src/views/mod.rs | 2 +-
proxmox-tui-installer/src/views/tabbed_view.rs | 2 +-
proxmox-tui-installer/src/views/table_view.rs | 4 ++--
proxmox-tui-installer/src/views/timezone.rs | 4 ++--
24 files changed, 71 insertions(+), 64 deletions(-)
diff --git a/proxmox-auto-install-assistant/src/main.rs b/proxmox-auto-install-assistant/src/main.rs
index 969922c..b64623b 100644
--- a/proxmox-auto-install-assistant/src/main.rs
+++ b/proxmox-auto-install-assistant/src/main.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Result};
+use anyhow::{Result, bail, format_err};
use clap::{Args, Parser, Subcommand, ValueEnum};
use glob::Pattern;
use serde::Serialize;
@@ -14,9 +14,9 @@ use proxmox_auto_installer::{
answer::{Answer, FilterMatch},
sysinfo::SysInfo,
utils::{
- get_matched_udev_indexes, get_nic_list, get_single_udev_index,
- verify_email_and_root_password_settings, verify_first_boot_settings,
- verify_locale_settings, AutoInstSettings, FetchAnswerFrom, HttpOptions,
+ AutoInstSettings, FetchAnswerFrom, HttpOptions, get_matched_udev_indexes, get_nic_list,
+ get_single_udev_index, verify_email_and_root_password_settings, verify_first_boot_settings,
+ verify_locale_settings,
},
};
use proxmox_installer_common::{FIRST_BOOT_EXEC_MAX_SIZE, FIRST_BOOT_EXEC_NAME};
@@ -624,7 +624,9 @@ fn check_prepare_requirements(args: &CommandPrepareISO) -> Result<()> {
{
Ok(v) => {
if !v.success() {
- bail!("The source ISO file is not able to be installed automatically. Please try a more current one.");
+ bail!(
+ "The source ISO file is not able to be installed automatically. Please try a more current one."
+ );
}
}
Err(err) if err.kind() == io::ErrorKind::NotFound => {
diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
index 5191a49..c11818e 100644
--- a/proxmox-auto-installer/src/answer.rs
+++ b/proxmox-auto-installer/src/answer.rs
@@ -1,4 +1,4 @@
-use anyhow::{format_err, Result};
+use anyhow::{Result, format_err};
use clap::ValueEnum;
use proxmox_installer_common::{
options::{
@@ -280,7 +280,7 @@ impl TryFrom<DiskSetup> for Disks {
}
match source.zfs {
None | Some(ZfsOptions { raid: None, .. }) => {
- return Err("ZFS raid level 'zfs.raid' must be set")
+ return Err("ZFS raid level 'zfs.raid' must be set");
}
Some(opts) => (FsType::Zfs(opts.raid.unwrap()), FsOptions::ZFS(opts)),
}
@@ -291,7 +291,7 @@ impl TryFrom<DiskSetup> for Disks {
}
match source.btrfs {
None | Some(BtrfsOptions { raid: None, .. }) => {
- return Err("BTRFS raid level 'btrfs.raid' must be set")
+ return Err("BTRFS raid level 'btrfs.raid' must be set");
}
Some(opts) => (FsType::Btrfs(opts.raid.unwrap()), FsOptions::BTRFS(opts)),
}
diff --git a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
index ca9dbf7..0f86af0 100644
--- a/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
+++ b/proxmox-auto-installer/src/bin/proxmox-auto-installer.rs
@@ -1,5 +1,5 @@
-use anyhow::{bail, format_err, Result};
-use log::{error, info, LevelFilter};
+use anyhow::{Result, bail, format_err};
+use log::{LevelFilter, error, info};
use std::{
env,
fs::{self, File},
@@ -9,12 +9,11 @@ use std::{
};
use proxmox_installer_common::{
- http,
+ FIRST_BOOT_EXEC_MAX_SIZE, FIRST_BOOT_EXEC_NAME, RUNTIME_DIR, http,
setup::{
- installer_setup, read_json, spawn_low_level_installer, LocaleInfo, LowLevelMessage,
- RuntimeInfo, SetupInfo,
+ LocaleInfo, LowLevelMessage, RuntimeInfo, SetupInfo, installer_setup, read_json,
+ spawn_low_level_installer,
},
- FIRST_BOOT_EXEC_MAX_SIZE, FIRST_BOOT_EXEC_NAME, RUNTIME_DIR,
};
use proxmox_auto_installer::{
diff --git a/proxmox-auto-installer/src/log.rs b/proxmox-auto-installer/src/log.rs
index 51b6661..f68e53a 100644
--- a/proxmox-auto-installer/src/log.rs
+++ b/proxmox-auto-installer/src/log.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use log::{Level, Metadata, Record};
use std::{fs::File, io::Write, sync::Mutex, sync::OnceLock};
diff --git a/proxmox-auto-installer/src/sysinfo.rs b/proxmox-auto-installer/src/sysinfo.rs
index a45ae59..fe3a10d 100644
--- a/proxmox-auto-installer/src/sysinfo.rs
+++ b/proxmox-auto-installer/src/sysinfo.rs
@@ -1,8 +1,8 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use proxmox_installer_common::{
+ RUNTIME_DIR,
setup::{IsoInfo, ProductConfig, SetupInfo},
sysinfo::SystemDMI,
- RUNTIME_DIR,
};
use serde::Serialize;
use std::{fs, io, path::PathBuf};
diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 44e0749..1789fd8 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Context, Result};
+use anyhow::{Context, Result, bail};
use clap::ValueEnum;
use glob::Pattern;
use log::info;
@@ -9,12 +9,12 @@ use crate::{
udevinfo::UdevInfo,
};
use proxmox_installer_common::{
- options::{email_validate, FsType, NetworkOptions, ZfsChecksumOption, ZfsCompressOption},
+ ROOT_PASSWORD_MIN_LENGTH,
+ options::{FsType, NetworkOptions, ZfsChecksumOption, ZfsCompressOption, email_validate},
setup::{
InstallBtrfsOption, InstallConfig, InstallFirstBootSetup, InstallRootPassword,
InstallZfsOption, LocaleInfo, RuntimeInfo, SetupInfo,
},
- ROOT_PASSWORD_MIN_LENGTH,
};
use serde::{Deserialize, Serialize};
@@ -286,7 +286,9 @@ fn verify_filesystem_settings(answer: &Answer, setup_info: &SetupInfo) -> Result
info!("Verifying filesystem settings");
if answer.disks.fs_type.is_btrfs() && !setup_info.config.enable_btrfs {
- bail!("BTRFS is not supported as a root filesystem for the product or the release of this ISO.");
+ bail!(
+ "BTRFS is not supported as a root filesystem for the product or the release of this ISO."
+ );
}
Ok(())
@@ -339,13 +341,17 @@ pub fn verify_email_and_root_password_settings(answer: &Answer) -> Result<()> {
&answer.global.root_password_hashed,
) {
(Some(_), Some(_)) => {
- bail!("`global.root_password` and `global.root_password_hashed` cannot be set at the same time");
+ bail!(
+ "`global.root_password` and `global.root_password_hashed` cannot be set at the same time"
+ );
}
(None, None) => {
bail!("One of `global.root_password` or `global.root_password_hashed` must be set");
}
(Some(password), None) if password.len() < ROOT_PASSWORD_MIN_LENGTH => {
- bail!("`global.root_password` must be at least {ROOT_PASSWORD_MIN_LENGTH} characters long");
+ bail!(
+ "`global.root_password` must be at least {ROOT_PASSWORD_MIN_LENGTH} characters long"
+ );
}
_ => Ok(()),
}
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 32f5e28..39b9401 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -8,7 +8,7 @@ use proxmox_auto_installer::udevinfo::UdevInfo;
use proxmox_auto_installer::utils::parse_answer;
use proxmox_installer_common::setup::{
- load_installer_setup_files, read_json, LocaleInfo, RuntimeInfo, SetupInfo,
+ LocaleInfo, RuntimeInfo, SetupInfo, load_installer_setup_files, read_json,
};
fn get_test_resource_path() -> Result<PathBuf, String> {
diff --git a/proxmox-chroot/src/main.rs b/proxmox-chroot/src/main.rs
index 594f9ab..f51f6d0 100644
--- a/proxmox-chroot/src/main.rs
+++ b/proxmox-chroot/src/main.rs
@@ -4,13 +4,13 @@ use std::{
process::Command,
};
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use clap::{Args, Parser, Subcommand, ValueEnum};
-use nix::mount::{mount, umount, MsFlags};
+use nix::mount::{MsFlags, mount, umount};
use proxmox_installer_common::{
+ RUNTIME_DIR,
options::FsType,
setup::{InstallConfig, SetupInfo},
- RUNTIME_DIR,
};
use regex::Regex;
@@ -132,7 +132,9 @@ fn get_fs(filesystem: Option<Filesystems>) -> Result<Filesystems> {
None => {
let low_level_config = match get_low_level_config() {
Ok(c) => c,
- Err(_) => bail!("Could not fetch config from previous installation. Please specify file system with -f."),
+ Err(_) => bail!(
+ "Could not fetch config from previous installation. Please specify file system with -f."
+ ),
};
Filesystems::from(low_level_config.filesys)
}
@@ -292,7 +294,9 @@ fn get_btrfs_uuid() -> Result<String> {
let uuid_list = uuids
.iter()
.fold(String::new(), |acc, &arg| format!("{acc}\n{arg}"));
- bail!("Found {i} UUIDs:{uuid_list}\nPlease specify the UUID to use with the --btrfs-uuid parameter")
+ bail!(
+ "Found {i} UUIDs:{uuid_list}\nPlease specify the UUID to use with the --btrfs-uuid parameter"
+ )
}
_ => (),
}
diff --git a/proxmox-fetch-answer/src/fetch_plugins/http.rs b/proxmox-fetch-answer/src/fetch_plugins/http.rs
index 633d79d..9b3d15c 100644
--- a/proxmox-fetch-answer/src/fetch_plugins/http.rs
+++ b/proxmox-fetch-answer/src/fetch_plugins/http.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use log::info;
use serde::Serialize;
use std::{
diff --git a/proxmox-fetch-answer/src/fetch_plugins/partition.rs b/proxmox-fetch-answer/src/fetch_plugins/partition.rs
index 0f1fa7b..7a7b17a 100644
--- a/proxmox-fetch-answer/src/fetch_plugins/partition.rs
+++ b/proxmox-fetch-answer/src/fetch_plugins/partition.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, format_err, Result};
+use anyhow::{Result, bail, format_err};
use log::{info, warn};
use std::{
fs::{self, create_dir_all},
diff --git a/proxmox-fetch-answer/src/main.rs b/proxmox-fetch-answer/src/main.rs
index d56f8b9..c599bef 100644
--- a/proxmox-fetch-answer/src/main.rs
+++ b/proxmox-fetch-answer/src/main.rs
@@ -1,8 +1,8 @@
use std::process::ExitCode;
use std::{fs, path::PathBuf};
-use anyhow::{bail, format_err, Result};
-use log::{error, info, LevelFilter};
+use anyhow::{Result, bail, format_err};
+use log::{LevelFilter, error, info};
use proxmox_auto_installer::{
log::AutoInstLogger,
diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 0fd3e43..6ebf64c 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -1,4 +1,4 @@
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::net::{IpAddr, Ipv4Addr};
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 93818f3..723e15f 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -9,7 +9,7 @@ use std::{
process::{self, Command, Stdio},
};
-use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
+use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
use crate::{
options::{
diff --git a/proxmox-installer-common/src/sysinfo.rs b/proxmox-installer-common/src/sysinfo.rs
index 9746cb2..05e6de6 100644
--- a/proxmox-installer-common/src/sysinfo.rs
+++ b/proxmox-installer-common/src/sysinfo.rs
@@ -1,6 +1,6 @@
use std::{collections::HashMap, fs};
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use serde::Serialize;
const DMI_PATH: &str = "/sys/devices/virtual/dmi/id";
diff --git a/proxmox-installer-common/src/utils.rs b/proxmox-installer-common/src/utils.rs
index 8686edf..8adcec0 100644
--- a/proxmox-installer-common/src/utils.rs
+++ b/proxmox-installer-common/src/utils.rs
@@ -117,11 +117,7 @@ impl<'de> Deserialize<'de> for CidrAddress {
serde_plain::derive_serialize_from_display!(CidrAddress);
fn mask_limit(addr: &IpAddr) -> usize {
- if addr.is_ipv4() {
- 32
- } else {
- 128
- }
+ if addr.is_ipv4() { 32 } else { 128 }
}
/// Possible errors that might occur when parsing FQDNs.
diff --git a/proxmox-post-hook/src/main.rs b/proxmox-post-hook/src/main.rs
index d029b04..d03ce21 100644
--- a/proxmox-post-hook/src/main.rs
+++ b/proxmox-post-hook/src/main.rs
@@ -19,7 +19,7 @@ use std::{
process::{Command, ExitCode},
};
-use anyhow::{anyhow, bail, Context, Result};
+use anyhow::{Context, Result, anyhow, bail};
use proxmox_auto_installer::{
answer::{Answer, PostNotificationHookInfo},
udevinfo::{UdevInfo, UdevProperties},
@@ -27,8 +27,8 @@ use proxmox_auto_installer::{
use proxmox_installer_common::{
options::{Disk, FsType},
setup::{
- load_installer_setup_files, BootType, InstallConfig, IsoInfo, ProxmoxProduct, RuntimeInfo,
- SetupInfo,
+ BootType, InstallConfig, IsoInfo, ProxmoxProduct, RuntimeInfo, SetupInfo,
+ load_installer_setup_files,
},
sysinfo::SystemDMI,
utils::CidrAddress,
diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index b33b6f7..341e60c 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -3,6 +3,7 @@
use std::{collections::HashMap, env, net::IpAddr};
use cursive::{
+ Cursive, CursiveRunnable, ScreenId, View, XY,
event::Event,
theme::{ColorStyle, Effect, Effects, PaletteColor, Style},
view::{Nameable, Offset, Resizable, ViewWrapper},
@@ -10,17 +11,16 @@ use cursive::{
Button, Checkbox, Dialog, DummyView, EditView, Layer, LinearLayout, PaddedView, Panel,
ResizedView, ScrollView, SelectView, StackView, TextView,
},
- Cursive, CursiveRunnable, ScreenId, View, XY,
};
mod options;
use options::{InstallerOptions, PasswordOptions};
use proxmox_installer_common::{
- options::{email_validate, BootdiskOptions, NetworkOptions, TimezoneOptions},
- setup::{installer_setup, LocaleInfo, ProxmoxProduct, RuntimeInfo, SetupInfo},
- utils::Fqdn,
ROOT_PASSWORD_MIN_LENGTH,
+ options::{BootdiskOptions, NetworkOptions, TimezoneOptions, email_validate},
+ setup::{LocaleInfo, ProxmoxProduct, RuntimeInfo, SetupInfo, installer_setup},
+ utils::Fqdn,
};
mod setup;
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index 8c882b7..8dcd697 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -1,11 +1,11 @@
use crate::SummaryOption;
use proxmox_installer_common::{
+ EMAIL_DEFAULT_PLACEHOLDER,
options::{
BootdiskOptions, BtrfsRaidLevel, FsType, NetworkOptions, TimezoneOptions, ZfsRaidLevel,
},
setup::LocaleInfo,
- EMAIL_DEFAULT_PLACEHOLDER,
};
pub const FS_TYPES: &[FsType] = {
@@ -103,7 +103,7 @@ mod tests {
state: InterfaceState::Up,
mac: "01:23:45:67:89:ab".to_owned(),
addresses: Some(vec![
- CidrAddress::new(Ipv4Addr::new(192, 168, 0, 2), 24).unwrap()
+ CidrAddress::new(Ipv4Addr::new(192, 168, 0, 2), 24).unwrap(),
]),
},
);
diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index fffb05e..27959ae 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -4,17 +4,17 @@ use std::{
};
use cursive::{
+ Cursive, Vec2, View,
view::{Nameable, Resizable, ViewWrapper},
views::{
Button, Dialog, DummyView, LinearLayout, NamedView, PaddedView, Panel, ScrollView,
SelectView, TextView, ViewRef,
},
- Cursive, Vec2, View,
};
use super::{DiskSizeEditView, FormView, IntegerEditView, TabbedView};
-use crate::options::FS_TYPES;
use crate::InstallerState;
+use crate::options::FS_TYPES;
use proxmox_installer_common::{
disk_checks::{
@@ -22,9 +22,9 @@ use proxmox_installer_common::{
check_zfs_raid_config,
},
options::{
- AdvancedBootdiskOptions, BootdiskOptions, BtrfsBootdiskOptions, Disk, FsType,
- LvmBootdiskOptions, ZfsBootdiskOptions, BTRFS_COMPRESS_OPTIONS, ZFS_CHECKSUM_OPTIONS,
- ZFS_COMPRESS_OPTIONS,
+ AdvancedBootdiskOptions, BTRFS_COMPRESS_OPTIONS, BootdiskOptions, BtrfsBootdiskOptions,
+ Disk, FsType, LvmBootdiskOptions, ZFS_CHECKSUM_OPTIONS, ZFS_COMPRESS_OPTIONS,
+ ZfsBootdiskOptions,
},
setup::{BootType, ProductConfig, ProxmoxProduct, RuntimeInfo},
};
diff --git a/proxmox-tui-installer/src/views/install_progress.rs b/proxmox-tui-installer/src/views/install_progress.rs
index d001451..e2ad091 100644
--- a/proxmox-tui-installer/src/views/install_progress.rs
+++ b/proxmox-tui-installer/src/views/install_progress.rs
@@ -1,8 +1,8 @@
use cursive::{
+ CbSink, Cursive,
utils::Counter,
view::{Nameable, Resizable, ViewWrapper},
views::{Dialog, DummyView, LinearLayout, PaddedView, ProgressBar, TextView},
- CbSink, Cursive,
};
use std::{
fs::File,
@@ -12,8 +12,8 @@ use std::{
time::Duration,
};
-use crate::{abort_install_button, prompt_dialog, InstallerState};
-use proxmox_installer_common::setup::{spawn_low_level_installer, InstallConfig, LowLevelMessage};
+use crate::{InstallerState, abort_install_button, prompt_dialog};
+use proxmox_installer_common::setup::{InstallConfig, LowLevelMessage, spawn_low_level_installer};
pub struct InstallProgressView {
view: PaddedView<LinearLayout>,
diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
index b028543..4364489 100644
--- a/proxmox-tui-installer/src/views/mod.rs
+++ b/proxmox-tui-installer/src/views/mod.rs
@@ -1,11 +1,11 @@
use std::{net::IpAddr, str::FromStr, sync::Arc};
use cursive::{
+ Printer, Rect, Vec2, View,
event::{Event, EventResult},
theme::BaseColor,
view::{Resizable, ViewWrapper},
views::{EditView, LinearLayout, NamedView, ResizedView, SelectView, TextView},
- Printer, Rect, Vec2, View,
};
use proxmox_installer_common::utils::CidrAddress;
diff --git a/proxmox-tui-installer/src/views/tabbed_view.rs b/proxmox-tui-installer/src/views/tabbed_view.rs
index 2aeea6a..1331713 100644
--- a/proxmox-tui-installer/src/views/tabbed_view.rs
+++ b/proxmox-tui-installer/src/views/tabbed_view.rs
@@ -1,12 +1,12 @@
use std::borrow::{Borrow, BorrowMut};
use cursive::{
+ Printer, Vec2, View,
direction::Direction,
event::{AnyCb, Event, EventResult, Key},
theme::{ColorStyle, PaletteColor},
utils::{markup::StyledString, span::SpannedStr},
view::{CannotFocus, IntoBoxedView, Selector, ViewNotFound},
- Printer, Vec2, View,
};
pub struct TabbedView {
diff --git a/proxmox-tui-installer/src/views/table_view.rs b/proxmox-tui-installer/src/views/table_view.rs
index f1a88c7..08567b2 100644
--- a/proxmox-tui-installer/src/views/table_view.rs
+++ b/proxmox-tui-installer/src/views/table_view.rs
@@ -1,8 +1,8 @@
use cursive::{
+ Printer, Rect, Vec2, View,
direction::Direction,
event::{Event, EventResult},
- view::{scroll, CannotFocus},
- Printer, Rect, Vec2, View,
+ view::{CannotFocus, scroll},
};
const HEADER_HEIGHT: usize = 2;
diff --git a/proxmox-tui-installer/src/views/timezone.rs b/proxmox-tui-installer/src/views/timezone.rs
index deda600..22e69cd 100644
--- a/proxmox-tui-installer/src/views/timezone.rs
+++ b/proxmox-tui-installer/src/views/timezone.rs
@@ -1,11 +1,11 @@
use cursive::{
+ Cursive,
view::{Nameable, ViewWrapper},
views::{Dialog, NamedView, SelectView},
- Cursive,
};
use super::FormView;
-use crate::{system, InstallerState};
+use crate::{InstallerState, system};
use proxmox_installer_common::{
options::TimezoneOptions,
setup::{KeyboardMapping, LocaleInfo},
--
2.47.1
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pve-devel] applied-series: [PATCH installer 0/2] update to 2024 edition, run cargo fmt
2025-02-28 9:27 [pve-devel] [PATCH installer 0/2] update to 2024 edition, run cargo fmt Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 1/2] tree-wide: rust: update to 2024 edition Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 2/2] tree-wide: rust: run cargo fmt Christoph Heiss
@ 2025-02-28 15:05 ` Thomas Lamprecht
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-02-28 15:05 UTC (permalink / raw)
To: Proxmox VE development discussion, Christoph Heiss
Am 28.02.25 um 10:27 schrieb Christoph Heiss:
> As it says on the tin. First updates (and unifies) the edition across the
> workspace to 2024, afterwards let `cargo fmt` rip through.
>
> Christoph Heiss (2):
> tree-wide: rust: update to 2024 edition
> tree-wide: rust: run cargo fmt
>
> Cargo.toml | 1 +
> proxmox-auto-install-assistant/Cargo.toml | 2 +-
> proxmox-auto-install-assistant/src/main.rs | 12 +++++++-----
> proxmox-auto-installer/Cargo.toml | 2 +-
> proxmox-auto-installer/src/answer.rs | 6 +++---
> .../src/bin/proxmox-auto-installer.rs | 11 +++++------
> proxmox-auto-installer/src/log.rs | 2 +-
> proxmox-auto-installer/src/sysinfo.rs | 4 ++--
> proxmox-auto-installer/src/utils.rs | 18 ++++++++++++------
> proxmox-auto-installer/tests/parse-answer.rs | 2 +-
> proxmox-chroot/Cargo.toml | 2 +-
> proxmox-chroot/src/main.rs | 14 +++++++++-----
> proxmox-fetch-answer/Cargo.toml | 2 +-
> proxmox-fetch-answer/src/fetch_plugins/http.rs | 2 +-
> .../src/fetch_plugins/partition.rs | 2 +-
> proxmox-fetch-answer/src/main.rs | 4 ++--
> proxmox-installer-common/Cargo.toml | 2 +-
> proxmox-installer-common/src/options.rs | 2 +-
> proxmox-installer-common/src/setup.rs | 2 +-
> proxmox-installer-common/src/sysinfo.rs | 2 +-
> proxmox-installer-common/src/utils.rs | 6 +-----
> proxmox-post-hook/Cargo.toml | 2 +-
> proxmox-post-hook/src/main.rs | 6 +++---
> proxmox-tui-installer/Cargo.toml | 2 +-
> proxmox-tui-installer/src/main.rs | 8 ++++----
> proxmox-tui-installer/src/options.rs | 4 ++--
> proxmox-tui-installer/src/views/bootdisk.rs | 10 +++++-----
> .../src/views/install_progress.rs | 6 +++---
> proxmox-tui-installer/src/views/mod.rs | 2 +-
> proxmox-tui-installer/src/views/tabbed_view.rs | 2 +-
> proxmox-tui-installer/src/views/table_view.rs | 4 ++--
> proxmox-tui-installer/src/views/timezone.rs | 4 ++--
> rustfmt.toml | 2 +-
> 33 files changed, 80 insertions(+), 72 deletions(-)
>
applied, thanks!
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-28 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-28 9:27 [pve-devel] [PATCH installer 0/2] update to 2024 edition, run cargo fmt Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 1/2] tree-wide: rust: update to 2024 edition Christoph Heiss
2025-02-28 9:27 ` [pve-devel] [PATCH installer 2/2] tree-wide: rust: run cargo fmt Christoph Heiss
2025-02-28 15:05 ` [pve-devel] applied-series: [PATCH installer 0/2] update to 2024 edition, " Thomas Lamprecht
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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal