]> git.lizzy.rs Git - rust.git/blob - src/tools/tidy/src/debug_artifacts.rs
Auto merge of #102573 - RalfJung:mirisync, r=oli-obk
[rust.git] / src / tools / tidy / src / debug_artifacts.rs
1 //! Tidy check to prevent creation of unnecessary debug artifacts while running tests.
2
3 use crate::walk::{filter_dirs, walk};
4 use std::path::{Path, PathBuf};
5
6 const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
7
8 pub fn check(path: &Path, bad: &mut bool) {
9     let test_dir: PathBuf = path.join("test");
10
11     walk(&test_dir, &mut filter_dirs, &mut |entry, contents| {
12         let filename = entry.path();
13         let is_rust = filename.extension().map_or(false, |ext| ext == "rs");
14         if !is_rust {
15             return;
16         }
17
18         for (i, line) in contents.lines().enumerate() {
19             if line.contains("borrowck_graphviz_postflow") {
20                 tidy_error!(bad, "{}:{}: {}", filename.display(), i + 1, GRAPHVIZ_POSTFLOW_MSG);
21             }
22         }
23     });
24 }