From b2cd3374e9a7ed637b1b5f1a85cb92a7928d712d Mon Sep 17 00:00:00 2001 From: DebugSteven Date: Mon, 28 Nov 2022 16:08:00 -0700 Subject: [PATCH] remove leading comma from macro expansion --- src/bootstrap/bootstrap.py | 4 ++-- src/tools/tidy/src/lib.rs | 2 +- src/tools/tidy/src/main.rs | 22 +++------------------- src/tools/tidy/src/{x.rs => x_version.rs} | 4 +--- 4 files changed, 7 insertions(+), 25 deletions(-) rename src/tools/tidy/src/{x.rs => x_version.rs} (88%) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 9cf43fc7a21..d7ba015982a 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -934,8 +934,8 @@ def main(): if len(sys.argv) > 1 and sys.argv[1] == 'help': sys.argv = [sys.argv[0], '-h'] + sys.argv[2:] - help_triggered = ( - '-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1) + # help_triggered = ('-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1) + help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv) try: bootstrap(help_triggered) if not help_triggered: diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index bfcf0907365..4075f2616b0 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -69,4 +69,4 @@ pub mod ui_tests; pub mod unit_tests; pub mod unstable_book; pub mod walk; -pub mod x; +pub mod x_version; diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index f01d4673368..56fcc561a3f 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -53,34 +53,18 @@ fn main() { VecDeque::with_capacity(concurrency.get()); macro_rules! check { - ($p:ident) => { - while handles.len() >= concurrency.get() { - handles.pop_front().unwrap().join().unwrap(); - } - - let handle = s.spawn(|| { - let mut flag = false; - $p::check(&mut flag); - if (flag) { - bad.store(true, Ordering::Relaxed); - } - }); - handles.push_back(handle); - }; - ($p:ident $(, $args:expr)* ) => { drain_handles(&mut handles); let handle = s.spawn(|| { let mut flag = false; - $p::check($($args),* , &mut flag); + $p::check($($args, )* &mut flag); if (flag) { bad.store(true, Ordering::Relaxed); } }); handles.push_back(handle); - }; - + } } check!(target_specific_tests, &src_path); @@ -123,7 +107,7 @@ fn main() { check!(alphabetical, &compiler_path); check!(alphabetical, &library_path); - check!(x); + check!(x_version); let collected = { drain_handles(&mut handles); diff --git a/src/tools/tidy/src/x.rs b/src/tools/tidy/src/x_version.rs similarity index 88% rename from src/tools/tidy/src/x.rs rename to src/tools/tidy/src/x_version.rs index 2cbbde8de82..148f97176f9 100644 --- a/src/tools/tidy/src/x.rs +++ b/src/tools/tidy/src/x_version.rs @@ -1,9 +1,7 @@ use std::process::Command; pub fn check(_bad: &mut bool) { - let result = Command::new("x") - .arg("--version") - .output(); + let result = Command::new("x").arg("--version").output(); let output = match result { Ok(output) => output, Err(_e) => todo!(),