From cebea16fe4af12d68d2bcfed6f006c40a0d576a6 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 25 Jan 2023 04:17:03 +0100 Subject: [PATCH] refactor: Move Args::partition call after panic::set_hook --- ruff_cli/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruff_cli/src/main.rs b/ruff_cli/src/main.rs index 587449b6c5..6ec21d1865 100644 --- a/ruff_cli/src/main.rs +++ b/ruff_cli/src/main.rs @@ -36,7 +36,7 @@ pub mod updates; fn inner_main() -> Result { // Extract command-line arguments. - let (cli, overrides) = Args::parse().partition(); + let args = Args::parse(); let default_panic_hook = std::panic::take_hook(); std::panic::set_hook(Box::new(move |info| { @@ -53,6 +53,8 @@ quoting the executed command, along with the relevant file contents and `pyproje default_panic_hook(info); })); + let (cli, overrides) = args.partition(); + let log_level = extract_log_level(&cli); set_up_logging(&log_level)?;