diff options
| author | Deadbeef <ent3rm4n@gmail.com> | 2021-12-17 21:53:28 +0800 |
|---|---|---|
| committer | Deadbeef <ent3rm4n@gmail.com> | 2021-12-23 19:03:47 +0800 |
| commit | 06a1c14d52a8482a33416c21b320970cab80cccc (patch) | |
| tree | c65ae1e5cf06d9bf4ec6d9db91427e39a65acdda /src | |
| parent | f52eb4ca8b21371f435a1941e05af749a5894df1 (diff) | |
Switch all libraries to the 2021 edition
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/tidy/src/edition.rs | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs index f610dbd806a..b0abee45986 100644 --- a/src/tools/tidy/src/edition.rs +++ b/src/tools/tidy/src/edition.rs @@ -2,11 +2,6 @@ use std::path::Path; -fn is_edition_2018(mut line: &str) -> bool { - line = line.trim(); - line == "edition = \"2018\"" -} - fn is_edition_2021(mut line: &str) -> bool { line = line.trim(); line == "edition = \"2021\"" @@ -23,27 +18,13 @@ pub fn check(path: &Path, bad: &mut bool) { return; } - // Not all library crates are ready to migrate to 2021. - if file.components().any(|c| c.as_os_str() == "library") - && file.components().all(|c| c.as_os_str() != "std") - { - let has = contents.lines().any(is_edition_2018); - if !has { - tidy_error!( - bad, - "{} doesn't have `edition = \"2018\"` on a separate line", - file.display() - ); - } - } else { - let is_2021 = contents.lines().any(is_edition_2021); - if !is_2021 { - tidy_error!( - bad, - "{} doesn't have `edition = \"2021\"` on a separate line", - file.display() - ); - } + let is_2021 = contents.lines().any(is_edition_2021); + if !is_2021 { + tidy_error!( + bad, + "{} doesn't have `edition = \"2021\"` on a separate line", + file.display() + ); } }, ); |
