1894: Eradicate warnings r=pksunkara a=CreepySkeleton



Co-authored-by: CreepySkeleton <creepy-skeleton@yandex.ru>
This commit is contained in:
bors[bot] 2020-05-03 06:50:57 +00:00 committed by GitHub
commit 2ba7816c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 22 deletions

View file

@ -39,7 +39,7 @@ jobs:
script: script:
- echo "Checking codebase with Clippy release `cargo clippy --version`." - echo "Checking codebase with Clippy release `cargo clippy --version`."
- cargo clippy --lib --features "yaml unstable" -- -D warnings - cargo clippy --lib --features "yaml unstable" -- -D warnings
- cargo clippy --tests --examples --features "yaml unstable" - cargo clippy --tests --examples --features "yaml unstable" -- -D warnings
- cargo fmt -- --check - cargo fmt -- --check
- name: Coverage - name: Coverage
addons: addons:

View file

@ -58,7 +58,7 @@ fn main() {
0 => println!("Debug mode is off"), 0 => println!("Debug mode is off"),
1 => println!("Debug mode is kind of on"), 1 => println!("Debug mode is kind of on"),
2 => println!("Debug mode is on"), 2 => println!("Debug mode is on"),
3 | _ => println!("Don't be crazy"), _ => println!("Don't be crazy"),
} }
// You can check for the existence of subcommands, and if found use their // You can check for the existence of subcommands, and if found use their

View file

@ -76,7 +76,7 @@ fn main() {
0 => println!("Debug mode is off"), 0 => println!("Debug mode is off"),
1 => println!("Debug mode is kind of on"), 1 => println!("Debug mode is kind of on"),
2 => println!("Debug mode is on"), 2 => println!("Debug mode is on"),
3 | _ => println!("Don't be crazy"), _ => println!("Don't be crazy"),
} }
// You can check for the existence of subcommands, and if found use their // You can check for the existence of subcommands, and if found use their

View file

@ -58,7 +58,7 @@ fn main() {
0 => println!("Debug mode is off"), 0 => println!("Debug mode is off"),
1 => println!("Debug mode is kind of on"), 1 => println!("Debug mode is kind of on"),
2 => println!("Debug mode is on"), 2 => println!("Debug mode is on"),
3 | _ => println!("Don't be crazy"), _ => println!("Don't be crazy"),
} }
// You can information about subcommands by requesting their matches by name // You can information about subcommands by requesting their matches by name

View file

@ -47,7 +47,7 @@ fn main() {
0 => println!("Nothing is awesome"), 0 => println!("Nothing is awesome"),
1 => println!("Some things are awesome"), 1 => println!("Some things are awesome"),
2 => println!("Lots of things are awesome"), 2 => println!("Lots of things are awesome"),
3 | _ => println!("EVERYTHING is awesome!"), _ => println!("EVERYTHING is awesome!"),
} }
// Continued program logic goes here... // Continued program logic goes here...

View file

@ -63,7 +63,7 @@ fn main() {
0 => println!("Debug mode is off"), 0 => println!("Debug mode is off"),
1 => println!("Debug mode is kind of on"), 1 => println!("Debug mode is kind of on"),
2 => println!("Debug mode is on"), 2 => println!("Debug mode is on"),
3 | _ => println!("Don't be crazy"), _ => println!("Don't be crazy"),
} }
// You can check for the existence of subcommands, and if found use their // You can check for the existence of subcommands, and if found use their

View file

@ -31,11 +31,12 @@ use crate::{
// FIXME (@CreepySkeleton): some of these variants are never constructed // FIXME (@CreepySkeleton): some of these variants are never constructed
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[allow(unused)]
pub(crate) enum Propagation { pub(crate) enum Propagation {
To(Id), To(Id),
Full, Full,
#[cfg_attr(not(test), allow(unused))]
NextLevel, NextLevel,
#[allow(unused)]
None, None,
} }
@ -1582,6 +1583,7 @@ impl<'b> App<'b> {
} }
} }
#[cfg(debug_assertions)]
fn two_args_of<F>(&self, condition: F) -> Option<(&Arg, &Arg)> fn two_args_of<F>(&self, condition: F) -> Option<(&Arg, &Arg)>
where where
F: Fn(&Arg<'_>) -> bool, F: Fn(&Arg<'_>) -> bool,
@ -1600,6 +1602,7 @@ impl<'b> App<'b> {
// Perform some expensive assertions on the Parser itself // Perform some expensive assertions on the Parser itself
#[allow(clippy::cognitive_complexity)] #[allow(clippy::cognitive_complexity)]
#[cfg(debug_assertions)]
fn _debug_asserts(&self) { fn _debug_asserts(&self) {
debug!("App::_debug_asserts"); debug!("App::_debug_asserts");
@ -2006,6 +2009,7 @@ impl<'b> App<'b> {
.any(|sc| !sc.is_set(AppSettings::Hidden)) .any(|sc| !sc.is_set(AppSettings::Hidden))
} }
#[cfg(debug_assertions)]
pub(crate) fn id_exists(&self, id: &Id) -> bool { 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) self.args.args.iter().any(|x| x.id == *id) || self.groups.iter().any(|x| x.id == *id)
} }

View file

@ -113,7 +113,7 @@ macro_rules! crate_authors {
use std::cell::Cell; use std::cell::Cell;
#[allow(missing_copy_implementations)] #[allow(missing_copy_implementations)]
#[allow(dead_code)] #[allow(unused)]
struct CargoAuthors { struct CargoAuthors {
authors: Cell<Option<&'static str>>, authors: Cell<Option<&'static str>>,
__private_field: (), __private_field: (),

View file

@ -145,11 +145,6 @@ impl<'b, 'c, 'd, 'w> Help<'b, 'c, 'd, 'w> {
write_method!(self, msg, warning) 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<()> { fn none(&mut self, msg: &str) -> io::Result<()> {
write_method!(self, msg, none) write_method!(self, msg, none)
} }

View file

@ -86,13 +86,6 @@ impl ArgMatcher {
self.0.args.swap_remove(arg); 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) { pub(crate) fn insert(&mut self, name: &Id) {
self.0.args.insert(name.clone(), MatchedArg::new()); self.0.args.insert(name.clone(), MatchedArg::new());
} }

View file

@ -470,8 +470,8 @@ fn unset_settings() {
let m = m let m = m
.unset_setting(AppSettings::AllowInvalidUtf8) .unset_setting(AppSettings::AllowInvalidUtf8)
.unset_setting(AppSettings::ColorAuto); .unset_setting(AppSettings::ColorAuto);
assert!(!m.is_set(AppSettings::AllowInvalidUtf8), "{:#?}"); assert!(!m.is_set(AppSettings::AllowInvalidUtf8), "{:#?}", m);
assert!(!m.is_set(AppSettings::ColorAuto)); assert!(!m.is_set(AppSettings::ColorAuto), "{:#?}", m);
} }
#[test] #[test]