From 2eebd76a0472c43da5528cec8de5d3b151646096 Mon Sep 17 00:00:00 2001 From: CreepySkeleton Date: Sat, 2 May 2020 23:33:43 +0300 Subject: [PATCH] Eradicate warnings: main codebase --- src/build/app/mod.rs | 6 +++++- src/macros.rs | 2 +- src/output/help.rs | 5 ----- src/parse/arg_matcher.rs | 7 ------- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs index 3f4136ed..704f1283 100644 --- a/src/build/app/mod.rs +++ b/src/build/app/mod.rs @@ -31,11 +31,12 @@ use crate::{ // FIXME (@CreepySkeleton): some of these variants are never constructed #[derive(Clone, Debug, PartialEq, Eq)] -#[allow(unused)] pub(crate) enum Propagation { To(Id), Full, + #[cfg_attr(not(test), allow(unused))] NextLevel, + #[allow(unused)] None, } @@ -1582,6 +1583,7 @@ impl<'b> App<'b> { } } + #[cfg(debug_assertions)] fn two_args_of(&self, condition: F) -> Option<(&Arg, &Arg)> where F: Fn(&Arg<'_>) -> bool, @@ -1600,6 +1602,7 @@ impl<'b> App<'b> { // Perform some expensive assertions on the Parser itself #[allow(clippy::cognitive_complexity)] + #[cfg(debug_assertions)] fn _debug_asserts(&self) { debug!("App::_debug_asserts"); @@ -2006,6 +2009,7 @@ impl<'b> App<'b> { .any(|sc| !sc.is_set(AppSettings::Hidden)) } + #[cfg(debug_assertions)] pub(crate) fn id_exists(&self, id: &Id) -> bool { self.args.args.iter().any(|x| x.id == *id) || self.groups.iter().any(|x| x.id == *id) } diff --git a/src/macros.rs b/src/macros.rs index 82c18f47..537dde03 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -113,7 +113,7 @@ macro_rules! crate_authors { use std::cell::Cell; #[allow(missing_copy_implementations)] - #[allow(dead_code)] + #[allow(unused)] struct CargoAuthors { authors: Cell>, __private_field: (), diff --git a/src/output/help.rs b/src/output/help.rs index fddb3389..d1654037 100644 --- a/src/output/help.rs +++ b/src/output/help.rs @@ -145,11 +145,6 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> { write_method!(self, msg, warning) } - #[allow(dead_code)] - fn error(&mut self, msg: &str) -> io::Result<()> { - write_method!(self, msg, error) - } - fn none(&mut self, msg: &str) -> io::Result<()> { write_method!(self, msg, none) } diff --git a/src/parse/arg_matcher.rs b/src/parse/arg_matcher.rs index 9dda0a8d..e4a520be 100644 --- a/src/parse/arg_matcher.rs +++ b/src/parse/arg_matcher.rs @@ -86,13 +86,6 @@ impl ArgMatcher { self.0.args.swap_remove(arg); } - #[allow(dead_code)] - pub(crate) fn remove_all(&mut self, args: &[Id]) { - for arg in args { - self.0.args.swap_remove(arg); - } - } - pub(crate) fn insert(&mut self, name: &Id) { self.0.args.insert(name.clone(), MatchedArg::new()); }