Skip to content

Commit 2e6e33c

Browse files
chore: migrate to edition 2024 (#16029)
* `cargo fix --edition` * update editions * `cargo fmt` * revert drop orders change from `cargo fix --edition` * resolver v3 * fix audit * implicit readme links * update schemars to 0.8.22 * clippy * remove redundant unsafe * revert to 2021 fmt to keep the changes small * move all expr to 2024 * Revert "clippy" This reverts commit 671cd0c. * minor clippy fixes * Setup workspace lints and ignore `collapsible_if` * unsafe set var for mac * revert all format changes (hopefully) * more unsafe set var * `no_mangle` is now unsafe * Bump schemars fork * rename `gen`s * audit unsafe env var modifications * revert more formatting diffs * Add change file * edition 2024 notice * fix bench warnings
1 parent bca4ca5 commit 2e6e33c

62 files changed

Lines changed: 444 additions & 346 deletions

File tree

Some content is hidden

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

‎.changes/edition-2024-template.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
tauri-cli: minor:changes
3+
"@tauri-apps/cli": minor:changes
4+
---
5+
6+
Moved to edition 2024 for the `tauri init`/`tauri plugin init` templates

‎.changes/edition-2024.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
"tauri": minor:changes
3+
"tauri-utils": minor:changes
4+
"tauri-runtime": minor:changes
5+
"tauri-runtime-wry": minor:changes
6+
"tauri-codegen": minor:changes
7+
"tauri-macros": minor:changes
8+
"tauri-plugin": minor:changes
9+
"tauri-build": minor:changes
10+
"tauri-cli": minor:changes
11+
"tauri-macos-sign": minor:changes
12+
"tauri-bundler": minor:changes
13+
"tauri-driver": minor:changes
14+
---
15+
16+
Moved to edition 2024

‎Cargo.lock‎

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

‎Cargo.toml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ members = [
3434
"examples/api/src-tauri",
3535
"examples/api/src-tauri/tauri-plugin-sample",
3636
]
37-
resolver = "2"
37+
resolver = "3"
3838

3939
[workspace.package]
4040
authors = ["Tauri Programme within The Commons Conservancy"]
4141
homepage = "https://tauri.app/"
4242
repository = "https://github.com/tauri-apps/tauri"
4343
categories = ["gui", "web-programming"]
4444
license = "Apache-2.0 OR MIT"
45-
edition = "2021"
45+
edition = "2024"
4646
rust-version = "1.90"
4747

4848
[workspace.dependencies]
@@ -83,3 +83,7 @@ opt-level = "s"
8383
schemars_derive = { git = 'https://github.com/tauri-apps/schemars.git', branch = 'feat/preserve-description-newlines' }
8484
tauri = { path = "./crates/tauri" }
8585
tauri-plugin = { path = "./crates/tauri-plugin" }
86+
87+
[workspace.lints.clippy]
88+
# TODO: Update in next PR to keep changes small, see https://github.com/tauri-apps/tauri/pull/16029
89+
collapsible_if = "allow"

‎bench/Cargo.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "tauri_bench"
33
version = "0.1.0"
44
authors = ["Tauri Programme within The Commons Conservancy"]
5-
edition = "2021"
5+
edition = "2024"
66
rust-version = "1.90"
77
license = "Apache-2.0 OR MIT"
88
description = "Cross-platform WebView rendering library"
@@ -22,3 +22,6 @@ path = "src/run_benchmark.rs"
2222
[[bin]]
2323
name = "build_benchmark_jsons"
2424
path = "src/build_benchmark_jsons.rs"
25+
26+
[lints]
27+
workspace = true

‎bench/tests/cpu_intensive/src-tauri/Cargo.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bench_cpu_intensive"
33
version = "0.1.0"
44
description = "A very simple Tauri Application"
5-
edition = "2021"
5+
edition = "2024"
66
rust-version = "1.90"
77

88
[build-dependencies]
@@ -14,3 +14,6 @@ tauri-build = { workspace = true, default-features = true, features = [
1414
serde_json = "1"
1515
serde = { version = "1", features = ["derive"] }
1616
tauri = { workspace = true, default-features = true }
17+
18+
[lints]
19+
workspace = true

‎bench/tests/files_transfer/src-tauri/Cargo.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bench_files_transfer"
33
version = "0.1.0"
44
description = "A very simple Tauri Application"
5-
edition = "2021"
5+
edition = "2024"
66
rust-version = "1.90"
77

88
[build-dependencies]
@@ -14,3 +14,6 @@ tauri-build = { workspace = true, default-features = true, features = [
1414
serde_json = "1"
1515
serde = { version = "1", features = ["derive"] }
1616
tauri = { workspace = true, default-features = true }
17+
18+
[lints]
19+
workspace = true

‎bench/tests/helloworld/src-tauri/Cargo.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bench_helloworld"
33
version = "0.1.0"
44
description = "A very simple Tauri Application"
5-
edition = "2021"
5+
edition = "2024"
66
rust-version = "1.90"
77

88
[build-dependencies]
@@ -14,3 +14,6 @@ tauri-build = { workspace = true, default-features = true, features = [
1414
serde_json = "1"
1515
serde = { version = "1", features = ["derive"] }
1616
tauri = { workspace = true, default-features = true }
17+
18+
[lints]
19+
workspace = true

‎crates/tauri-build/Cargo.toml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name = "tauri-build"
33
version = "2.6.3"
44
description = "build time code to pair with https://crates.io/crates/tauri"
55
exclude = ["CHANGELOG.md", "/target"]
6-
readme = "README.md"
76
authors.workspace = true
87
homepage.workspace = true
98
repository.workspace = true
@@ -38,8 +37,8 @@ tauri-winres = "0.3"
3837
semver = "1"
3938
dirs = "6"
4039
glob = "0.3"
41-
# Our code requires at least 0.8.21 so don't simplify this to 0.8
42-
schemars = { version = "0.8.21", features = ["preserve_order"] }
40+
# Our code requires at least 0.8.22 so don't simplify this to 0.8
41+
schemars = { version = "0.8.22", features = ["preserve_order"] }
4342

4443
[features]
4544
default = ["config-json"]
@@ -48,3 +47,6 @@ isolation = ["tauri-codegen/isolation", "tauri-utils/isolation"]
4847
config-json = []
4948
config-json5 = ["tauri-utils/config-json5"]
5049
config-toml = ["tauri-utils/config-toml"]
50+
51+
[lints]
52+
workspace = true

‎crates/tauri-build/src/lib.rs‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
584584

585585
println!("cargo:rustc-env=TAURI_ENV_TARGET_TRIPLE={target_triple}");
586586
// when running codegen in this build script, we need to access the env var directly
587-
env::set_var("TAURI_ENV_TARGET_TRIPLE", &target_triple);
587+
// FIXME: This can be accessed from multiple threads
588+
unsafe { env::set_var("TAURI_ENV_TARGET_TRIPLE", &target_triple) };
588589

589590
let target_dir = target_dir_from_out_dir(&out_dir)
590591
.with_context(|| format!("failed to resolve the target directory from {out_dir:?}"))?;
@@ -873,18 +874,18 @@ mod tests {
873874
assert!(crate::should_static_link_vc_runtime(&config, &attributes));
874875

875876
// 2. Set to anything but "false" in env, should be true
876-
std::env::set_var("STATIC_VCRUNTIME", "qweqe");
877+
unsafe { std::env::set_var("STATIC_VCRUNTIME", "qweqe") };
877878
let config = tauri_utils::config::Config::default();
878879
let attributes = crate::Attributes::new();
879880
assert!(crate::should_static_link_vc_runtime(&config, &attributes));
880-
std::env::remove_var("STATIC_VCRUNTIME");
881+
unsafe { std::env::remove_var("STATIC_VCRUNTIME") };
881882

882883
// 3. Set to "false" in env, should be false
883-
std::env::set_var("STATIC_VCRUNTIME", "false");
884+
unsafe { std::env::set_var("STATIC_VCRUNTIME", "false") };
884885
let config = tauri_utils::config::Config::default();
885886
let attributes = crate::Attributes::new();
886887
assert!(!crate::should_static_link_vc_runtime(&config, &attributes));
887-
std::env::remove_var("STATIC_VCRUNTIME");
888+
unsafe { std::env::remove_var("STATIC_VCRUNTIME") };
888889

889890
// 4. Set to true in attributes, should be true
890891
let config = tauri_utils::config::Config::default();
@@ -939,11 +940,11 @@ mod tests {
939940
assert!(!crate::should_static_link_vc_runtime(&config, &attributes));
940941

941942
// 9. Set to false in env and true in attributes, should be false because env takes precedence over attributes
942-
std::env::set_var("STATIC_VCRUNTIME", "false");
943+
unsafe { std::env::set_var("STATIC_VCRUNTIME", "false") };
943944
let config = tauri_utils::config::Config::default();
944945
let attributes = crate::Attributes::new()
945946
.windows_attributes(crate::WindowsAttributes::new().static_vc_runtime(true));
946947
assert!(!crate::should_static_link_vc_runtime(&config, &attributes));
947-
std::env::remove_var("STATIC_VCRUNTIME");
948+
unsafe { std::env::remove_var("STATIC_VCRUNTIME") };
948949
}
949950
}

0 commit comments

Comments
 (0)