1 //! Tidy check to ensure that crate `edition` is '2018' or '2021'.
3 use crate::walk::{filter_dirs, walk};
6 fn is_edition_2021(mut line: &str) -> bool {
8 line == "edition = \"2021\""
11 pub fn check(path: &Path, bad: &mut bool) {
14 &mut |path| filter_dirs(path) || path.ends_with("src/test"),
15 &mut |entry, contents| {
16 let file = entry.path();
17 let filename = file.file_name().unwrap();
18 if filename != "Cargo.toml" {
22 let is_2021 = contents.lines().any(is_edition_2021);
26 "{} doesn't have `edition = \"2021\"` on a separate line",