From 7b28f80cd6698f79c1572b794c01141aafaff8c5 Mon Sep 17 00:00:00 2001 From: moxian Date: Mon, 31 Mar 2025 03:35:10 -0700 Subject: [PATCH] Actually, let's not bisect imports by default I thought it was a good idea, but now that reaper is not completely busted, i see that this is taking a bit longer than i'd like.. It's easier to just run reaper again --- src/lib.rs | 5 +++++ src/passes/item_deleter.rs | 2 +- testsuite/src/lib.rs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c5ce96c..24ca3ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -105,6 +105,10 @@ pub struct Options { #[arg(skip)] pub no_delete_functions: bool, + + /// Remove individual use statements manually, instead of relying on rustc lints output + #[arg(long)] + pub bisect_delete_imports: bool, } #[derive(Debug, Clone)] @@ -187,6 +191,7 @@ impl Default for Options { script_path_lints: None, ignore_file: Vec::new(), no_delete_functions: false, + bisect_delete_imports: false, } } } diff --git a/src/passes/item_deleter.rs b/src/passes/item_deleter.rs index 7537079..c1f3b50 100644 --- a/src/passes/item_deleter.rs +++ b/src/passes/item_deleter.rs @@ -76,7 +76,7 @@ impl<'a> Visitor<'a> { } // We would hope for the unused imports pass to catch all of these // but sadly that's not the case - Item::Use(ItemUse { tree, .. }) => { + Item::Use(ItemUse { tree, .. }) if self.checker.options.bisect_delete_imports => { self.current_path.push(tree.to_token_stream().to_string()); let should_retain = self.should_retain_item(); diff --git a/testsuite/src/lib.rs b/testsuite/src/lib.rs index 8c7e031..f841e5c 100644 --- a/testsuite/src/lib.rs +++ b/testsuite/src/lib.rs @@ -170,6 +170,7 @@ fn build(cargo: &Path, path: &Path, regression_checker_path: &Path) -> Result<() flag.push(regression_checker_path); flag }); + cmd.arg("--bisect-delete-imports"); let minimize_roots = start_roots.join(",");