]> git.lizzy.rs Git - rust.git/blob - src/tools/tidy/src/lib.rs
Auto merge of #102025 - chenyukang:fix-102002, r=jyn514
[rust.git] / src / tools / tidy / src / lib.rs
1 //! Library used by tidy and other tools.
2 //!
3 //! This library contains the tidy lints and exposes it
4 //! to be used by tools.
5
6 /// A helper macro to `unwrap` a result except also print out details like:
7 ///
8 /// * The expression that failed
9 /// * The error itself
10 /// * (optionally) a path connected to the error (e.g. failure to open a file)
11 #[macro_export]
12 macro_rules! t {
13     ($e:expr, $p:expr) => {
14         match $e {
15             Ok(e) => e,
16             Err(e) => panic!("{} failed on {} with {}", stringify!($e), ($p).display(), e),
17         }
18     };
19
20     ($e:expr) => {
21         match $e {
22             Ok(e) => e,
23             Err(e) => panic!("{} failed with {}", stringify!($e), e),
24         }
25     };
26 }
27
28 macro_rules! tidy_error {
29     ($bad:expr, $fmt:expr) => ({
30         *$bad = true;
31         eprint!("tidy error: ");
32         eprintln!($fmt);
33     });
34     ($bad:expr, $fmt:expr, $($arg:tt)*) => ({
35         *$bad = true;
36         eprint!("tidy error: ");
37         eprintln!($fmt, $($arg)*);
38     });
39 }
40
41 pub mod bins;
42 pub mod debug_artifacts;
43 pub mod deps;
44 pub mod edition;
45 pub mod error_codes_check;
46 pub mod errors;
47 pub mod extdeps;
48 pub mod features;
49 pub mod pal;
50 pub mod primitive_docs;
51 pub mod style;
52 pub mod target_specific_tests;
53 pub mod ui_tests;
54 pub mod unit_tests;
55 pub mod unstable_book;
56 pub mod walk;