Skip to content

Commit df9c87c

Browse files
authored
Rollup merge of #129634 - compiler-errors:tidy-2024, r=albertlarsan68
Fix tidy to allow `edition = "2024"` in `Cargo.toml` Needed to upgrade to edition 2024 eventually.
2 parents 6ab1805 + 56d8611 commit df9c87c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/tools/tidy/src/edition.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Tidy check to ensure that crate `edition` is '2018' or '2021'.
1+
//! Tidy check to ensure that crate `edition` is '2021' or '2024'.
22
33
use std::path::Path;
44

@@ -12,18 +12,20 @@ pub fn check(path: &Path, bad: &mut bool) {
1212
return;
1313
}
1414

15-
let is_2021 = contents.lines().any(|line| line.trim() == "edition = \"2021\"");
15+
let is_current_edition = contents
16+
.lines()
17+
.any(|line| line.trim() == "edition = \"2021\"" || line.trim() == "edition = \"2024\"");
1618

1719
let is_workspace = contents.lines().any(|line| line.trim() == "[workspace]");
1820
let is_package = contents.lines().any(|line| line.trim() == "[package]");
1921
assert!(is_workspace || is_package);
2022

2123
// Check that all packages use the 2021 edition. Virtual workspaces don't allow setting an
2224
// edition, so these shouldn't be checked.
23-
if is_package && !is_2021 {
25+
if is_package && !is_current_edition {
2426
tidy_error!(
2527
bad,
26-
"{} doesn't have `edition = \"2021\"` on a separate line",
28+
"{} doesn't have `edition = \"2021\"` or `edition = \"2024\"` on a separate line",
2729
file.display()
2830
);
2931
}

0 commit comments

Comments
 (0)