Skip to content

Commit 13d5db6

Browse files
Guara92cgwalters
authored andcommitted
Update workspace to Rust edition 2024
Migrate all crates from edition 2021 to 2024. This includes updating Cargo.toml files and fixing code compatibility issues. The MSRV is bumped to 1.85.0 to support edition 2024. Note: global_init() requires #[allow(unsafe_code)] for std::env::set_var which is now unsafe in edition 2024. This is safe because the function is called early in main() before any threads are spawned. Closes: #1414 Signed-off-by: Daniele Guarascio <guarascio.daniele@gmail.com>
1 parent ab78a79 commit 13d5db6

78 files changed

Lines changed: 316 additions & 235 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/blockdev/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
description = "Internal implementation component of bootc; do not use"
3-
edition = "2021"
3+
edition = "2024"
44
license = "MIT OR Apache-2.0"
55
name = "bootc-internal-blockdev"
66
repository = "https://github.com/bootc-dev/bootc"
@@ -27,4 +27,4 @@ tracing = { workspace = true }
2727
indoc = { workspace = true }
2828

2929
[lib]
30-
path = "src/blockdev.rs"
30+
path = "src/blockdev.rs"

crates/blockdev/src/blockdev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::path::Path;
44
use std::process::{Command, Stdio};
55
use std::sync::OnceLock;
66

7-
use anyhow::{anyhow, Context, Result};
7+
use anyhow::{Context, Result, anyhow};
88
use camino::{Utf8Path, Utf8PathBuf};
99
use fn_error_context::context;
1010
use regex::Regex;

crates/cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bootc"
33
# This is a stub, the real version is from the lib crate
44
version = "0.0.0"
5-
edition = "2021"
5+
edition = "2024"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/bootc-dev/bootc"
88
publish = false

crates/initramfs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bootc-initramfs-setup"
33
version = "0.1.0"
44
license = "MIT OR Apache-2.0"
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

crates/initramfs/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use std::{
1111
use anyhow::{Context, Result};
1212
use clap::Parser;
1313
use rustix::{
14-
fs::{major, minor, mkdirat, openat, stat, symlink, Mode, OFlags, CWD},
14+
fs::{CWD, Mode, OFlags, major, minor, mkdirat, openat, stat, symlink},
1515
io::Errno,
1616
mount::{
17-
fsconfig_create, fsconfig_set_string, fsmount, open_tree, unmount, FsMountFlags,
18-
MountAttrFlags, OpenTreeFlags, UnmountFlags,
17+
FsMountFlags, MountAttrFlags, OpenTreeFlags, UnmountFlags, fsconfig_create,
18+
fsconfig_set_string, fsmount, open_tree, unmount,
1919
},
2020
path,
2121
};

crates/initramfs/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use anyhow::Result;
55

6-
use bootc_initramfs_setup::{gpt_workaround, setup_root, Args};
6+
use bootc_initramfs_setup::{Args, gpt_workaround, setup_root};
77
use clap::Parser;
88

99
fn main() -> Result<()> {

crates/kernel_cmdline/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bootc-kernel-cmdline"
33
description = "Kernel command line parsing utilities for bootc"
44
version = "0.0.0"
5-
edition = "2021"
5+
edition = "2024"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/bootc-dev/bootc"
88

@@ -16,4 +16,4 @@ similar-asserts = { workspace = true }
1616
static_assertions = { workspace = true }
1717

1818
[lints]
19-
workspace = true
19+
workspace = true

crates/kernel_cmdline/src/bytes.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::borrow::Cow;
77
use std::cmp::Ordering;
88
use std::ops::Deref;
99

10-
use crate::{utf8, Action};
10+
use crate::{Action, utf8};
1111

1212
use anyhow::Result;
1313
use serde::{Deserialize, Serialize};
@@ -842,15 +842,17 @@ mod tests {
842842

843843
// Test key without value should fail
844844
let err = kargs.require_value_of("switch").unwrap_err();
845-
assert!(err
846-
.to_string()
847-
.contains("Failed to find kernel argument 'switch'"));
845+
assert!(
846+
err.to_string()
847+
.contains("Failed to find kernel argument 'switch'")
848+
);
848849

849850
// Test non-existent key should fail
850851
let err = kargs.require_value_of("missing").unwrap_err();
851-
assert!(err
852-
.to_string()
853-
.contains("Failed to find kernel argument 'missing'"));
852+
assert!(
853+
err.to_string()
854+
.contains("Failed to find kernel argument 'missing'")
855+
);
854856

855857
// Test dash/underscore equivalence
856858
let kargs = Cmdline::from(b"dash-key=value1 under_key=value2".as_slice());

crates/kernel_cmdline/src/utf8.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
use std::ops::Deref;
77

8-
use crate::{bytes, Action};
8+
use crate::{Action, bytes};
99

1010
use anyhow::Result;
1111
use serde::{Deserialize, Serialize};
@@ -697,15 +697,17 @@ mod tests {
697697

698698
// Test key without value should fail
699699
let err = kargs.require_value_of("switch").unwrap_err();
700-
assert!(err
701-
.to_string()
702-
.contains("Failed to find kernel argument 'switch'"));
700+
assert!(
701+
err.to_string()
702+
.contains("Failed to find kernel argument 'switch'")
703+
);
703704

704705
// Test non-existent key should fail
705706
let err = kargs.require_value_of("missing").unwrap_err();
706-
assert!(err
707-
.to_string()
708-
.contains("Failed to find kernel argument 'missing'"));
707+
assert!(
708+
err.to_string()
709+
.contains("Failed to find kernel argument 'missing'")
710+
);
709711

710712
// Test dash/underscore equivalence
711713
let kargs = Cmdline::from("dash-key=value1 under_key=value2");

0 commit comments

Comments
 (0)