tidy/
debug_artifacts.rs

1//! Tidy check to prevent creation of unnecessary debug artifacts while running tests.
2
3use std::path::Path;
4
5use crate::walk::{filter_dirs, filter_not_rust, walk};
6
7const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
8
9pub fn check(test_dir: &Path, bad: &mut bool) {
10    walk(
11        test_dir,
12        |path, _is_dir| filter_dirs(path) || filter_not_rust(path),
13        &mut |entry, contents| {
14            for (i, line) in contents.lines().enumerate() {
15                if line.contains("borrowck_graphviz_postflow") {
16                    tidy_error!(
17                        bad,
18                        "{}:{}: {}",
19                        entry.path().display(),
20                        i + 1,
21                        GRAPHVIZ_POSTFLOW_MSG
22                    );
23                }
24            }
25        },
26    );
27}