1use termcolor::WriteColor;
7
8macro_rules! static_regex {
9 ($re:literal) => {{
10 static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
11 RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
12 }};
13}
14
15#[macro_export]
21macro_rules! t {
22 ($e:expr, $p:expr) => {
23 match $e {
24 Ok(e) => e,
25 Err(e) => panic!("{} failed on {} with {}", stringify!($e), ($p).display(), e),
26 }
27 };
28
29 ($e:expr) => {
30 match $e {
31 Ok(e) => e,
32 Err(e) => panic!("{} failed with {}", stringify!($e), e),
33 }
34 };
35}
36
37macro_rules! tidy_error {
38 ($bad:expr, $($fmt:tt)*) => ({
39 $crate::tidy_error(&format_args!($($fmt)*).to_string()).expect("failed to output error");
40 *$bad = true;
41 });
42}
43
44macro_rules! tidy_error_ext {
45 ($tidy_error:path, $bad:expr, $($fmt:tt)*) => ({
46 $tidy_error(&format_args!($($fmt)*).to_string()).expect("failed to output error");
47 *$bad = true;
48 });
49}
50
51fn tidy_error(args: &str) -> std::io::Result<()> {
52 use std::io::Write;
53
54 use termcolor::{Color, ColorChoice, ColorSpec, StandardStream};
55
56 let mut stderr = StandardStream::stdout(ColorChoice::Auto);
57 stderr.set_color(ColorSpec::new().set_fg(Some(Color::Red)))?;
58
59 write!(&mut stderr, "tidy error")?;
60 stderr.set_color(&ColorSpec::new())?;
61
62 writeln!(&mut stderr, ": {args}")?;
63 Ok(())
64}
65
66pub mod alphabetical;
67pub mod bins;
68pub mod debug_artifacts;
69pub mod deps;
70pub mod edition;
71pub mod error_codes;
72pub mod ext_tool_checks;
73pub mod extdeps;
74pub mod features;
75pub mod fluent_alphabetical;
76pub mod fluent_period;
77mod fluent_used;
78pub(crate) mod iter_header;
79pub mod known_bug;
80pub mod mir_opt_tests;
81pub mod pal;
82pub mod rustdoc_css_themes;
83pub mod rustdoc_gui_tests;
84pub mod rustdoc_templates;
85pub mod style;
86pub mod target_policy;
87pub mod target_specific_tests;
88pub mod tests_placement;
89pub mod tests_revision_unpaired_stdout_stderr;
90pub mod triagebot;
91pub mod ui_tests;
92pub mod unit_tests;
93pub mod unknown_revision;
94pub mod unstable_book;
95pub mod walk;
96pub mod x_version;