1 //! Library used by tidy and other tools.
3 //! This library contains the tidy lints and exposes it
4 //! to be used by tools.
11 ($e:expr, $p:expr) => (match $e {
13 Err(e) => panic!("{} failed on {} with {}", stringify!($e), ($p).display(), e),
16 ($e:expr) => (match $e {
18 Err(e) => panic!("{} failed with {}", stringify!($e), e),
22 macro_rules! tidy_error {
23 ($bad:expr, $fmt:expr, $($arg:tt)*) => ({
25 eprint!("tidy error: ");
26 eprintln!($fmt, $($arg)*);
39 pub mod unstable_book;
42 fn filter_dirs(path: &Path) -> bool {
46 "src/llvm-emscripten",
48 "src/librustc_data_structures/owning_ref",
54 "src/tools/rust-installer",
65 skip.iter().any(|p| path.ends_with(p))
68 fn walk_many(paths: &[&Path], skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) {
74 fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) {
75 let walker = WalkDir::new(path).into_iter()
76 .filter_entry(|e| !skip(e.path()));
78 if let Ok(entry) = entry {
79 if entry.file_type().is_dir() {