From 9a8b2ed61c1f6a0a06e2f90b75a1cbb2c6416af4 Mon Sep 17 00:00:00 2001 From: Caleb Stanford Date: Thu, 22 Aug 2024 12:58:11 -0700 Subject: [PATCH] :wrench: add -s option and suppress warnings --- src/bin/scan.rs | 14 ++++++++++---- src/resolution/hacky_resolver.rs | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/bin/scan.rs b/src/bin/scan.rs index c263f0b..0ac9aae 100644 --- a/src/bin/scan.rs +++ b/src/bin/scan.rs @@ -24,9 +24,13 @@ struct Args { #[clap(short = 'd', long = "crate-download-path", default_value = ".stats_tmp")] crate_download_path: String, - // Run in quick mode (turns off RustAnalyzer) + /// Run in quick mode (turns off RustAnalyzer) #[clap(short, long, default_value_t = false)] quick_mode: bool, + + /// Suppress "total" lines at the bottom of the output + #[clap(short, long, default_value_t = false)] + suppress_total: bool, } fn main() { @@ -42,7 +46,9 @@ fn main() { println!("{}", effect.to_csv()); } - println!(); - println!("{}", CrateStats::metadata_csv_header()); - println!("{}", stats.metadata_csv()); + if !args.suppress_total { + println!(); + println!("{}", CrateStats::metadata_csv_header()); + println!("{}", stats.metadata_csv()); + } } diff --git a/src/resolution/hacky_resolver.rs b/src/resolution/hacky_resolver.rs index 014357d..07aa838 100644 --- a/src/resolution/hacky_resolver.rs +++ b/src/resolution/hacky_resolver.rs @@ -294,10 +294,10 @@ impl<'a> HackyResolver<'a> { fn save_scope_use_under(&mut self, lookup_key: &'a syn::Ident) { // save the use scope under an identifier/lookup key let v_new = self.scope_use_snapshot(); - if log_enabled!(Level::Warn) && self.use_names.contains_key(lookup_key) { + if log_enabled!(Level::Debug) && self.use_names.contains_key(lookup_key) { let v_old = self.use_names.get(lookup_key).unwrap(); if *v_old != v_new { - warn!( + debug!( "Name conflict found in use scope: {:?} (old: {:?} new: {:?})", lookup_key, v_old, v_new );