From 1cff11109e3cd0ce8edf54533cf3e81ed3799d2d Mon Sep 17 00:00:00 2001 From: CreepySkeleton Date: Fri, 13 Mar 2020 20:51:41 +0300 Subject: [PATCH 1/2] Fix CI --- clap_derive/tests/ui/non_existent_attr.stderr | 2 +- clap_derive/tests/ui/tuple_struct.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clap_derive/tests/ui/non_existent_attr.stderr b/clap_derive/tests/ui/non_existent_attr.stderr index 3ad7af65..71f1a5b2 100644 --- a/clap_derive/tests/ui/non_existent_attr.stderr +++ b/clap_derive/tests/ui/non_existent_attr.stderr @@ -1,4 +1,4 @@ -error[E0599]: no method named `non_existing_attribute` found for type `clap::build::arg::Arg<'_>` in the current scope +error[E0599]: no method named `non_existing_attribute` found for struct `clap::build::arg::Arg<'_>` in the current scope --> $DIR/non_existent_attr.rs:14:19 | 14 | #[clap(short, non_existing_attribute = 1)] diff --git a/clap_derive/tests/ui/tuple_struct.stderr b/clap_derive/tests/ui/tuple_struct.stderr index 3303352e..781c308a 100644 --- a/clap_derive/tests/ui/tuple_struct.stderr +++ b/clap_derive/tests/ui/tuple_struct.stderr @@ -4,7 +4,7 @@ error: `#[derive(Clap)]` only supports non-tuple structs and enums 11 | #[derive(Clap, Debug)] | ^^^^ -error[E0599]: no function or associated item named `parse` found for type `Opt` in the current scope +error[E0599]: no function or associated item named `parse` found for struct `Opt` in the current scope --> $DIR/tuple_struct.rs:16:20 | 13 | struct Opt(u32); From b61a80772884ad97a794c191c370e13e4bfef34b Mon Sep 17 00:00:00 2001 From: CreepySkeleton Date: Fri, 13 Mar 2020 21:26:45 +0300 Subject: [PATCH 2/2] Fix clippy and bump MSRV --- .azure-pipelines.yml | 2 +- .travis.yml | 4 ++-- clap_derive/tests/macro-errors.rs | 2 +- src/build/app/mod.rs | 4 ++-- src/build/arg/mod.rs | 6 +++--- src/build/arg_group.rs | 2 +- src/macros.rs | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 6eaee63c..fac377ff 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -14,7 +14,7 @@ stages: jobs: - job: variables: - rust: 1.36.0 + rust: 1.40.0 strategy: matrix: Windows 32-bit (MSVC): diff --git a/.travis.yml b/.travis.yml index 02f304d2..6e3c826c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,8 @@ jobs: fast_finish: true include: - os: osx - rust: 1.36.0 - - rust: 1.36.0 + rust: 1.40.0 + - rust: 1.40.0 - {} - rust: beta - rust: nightly diff --git a/clap_derive/tests/macro-errors.rs b/clap_derive/tests/macro-errors.rs index ae4f5a28..9c5bf437 100644 --- a/clap_derive/tests/macro-errors.rs +++ b/clap_derive/tests/macro-errors.rs @@ -5,7 +5,7 @@ // , at your // option. This file may not be copied, modified, or distributed -#[rustversion::attr(any(not(stable), before(1.39)), ignore)] +#[rustversion::attr(any(not(stable), before(1.42)), ignore)] #[test] fn ui() { let t = trybuild::TestCases::new(); diff --git a/src/build/app/mod.rs b/src/build/app/mod.rs index 28ec97c7..94279574 100644 --- a/src/build/app/mod.rs +++ b/src/build/app/mod.rs @@ -146,7 +146,7 @@ impl<'b> App<'b> { /// Get the name of the binary pub fn get_bin_name(&self) -> Option<&str> { - self.bin_name.as_ref().map(String::as_str) + self.bin_name.as_deref() } /// Sets a string of author(s) that will be displayed to the user when they @@ -1957,7 +1957,7 @@ impl<'a> From<&'a Yaml> for App<'a> { App::new(name) } else { let yaml_hash = yaml.as_hash().unwrap(); - let sc_key = yaml_hash.keys().nth(0).unwrap(); + let sc_key = yaml_hash.keys().next().unwrap(); is_sc = Some(yaml_hash.get(sc_key).unwrap()); App::new(sc_key.as_str().unwrap()) }; diff --git a/src/build/arg/mod.rs b/src/build/arg/mod.rs index f3d230a7..20b1f125 100644 --- a/src/build/arg/mod.rs +++ b/src/build/arg/mod.rs @@ -171,7 +171,7 @@ impl<'help> Arg<'help> { #[allow(clippy::cognitive_complexity)] pub fn from_yaml(y: &yaml_rust::yaml::Hash) -> Arg { // We WANT this to panic on error...so expect() is good. - let name_yml = y.keys().nth(0).unwrap(); + let name_yml = y.keys().next().unwrap(); let name_str = name_yml.as_str().unwrap(); let mut a = Arg::with_name(name_str); let arg_settings = y.get(name_yml).unwrap().as_hash().unwrap(); @@ -817,7 +817,7 @@ impl<'help> Arg<'help> { /// assert!(res.is_err()); /// assert_eq!(res.unwrap_err().kind, ErrorKind::ArgumentConflict); /// ``` - /// + /// /// [`Arg::conflicts_with_all(names)`]: ./struct.Arg.html#method.conflicts_with_all /// [`Arg::exclusive(true)`]: ./struct.Arg.html#method.exclusive @@ -2115,7 +2115,7 @@ impl<'help> Arg<'help> { self.setb(ArgSettings::UseValueDelimiter); self.val_delim = Some( d.chars() - .nth(0) + .next() .expect("Failed to get value_delimiter from arg"), ); self diff --git a/src/build/arg_group.rs b/src/build/arg_group.rs index 9e223c9e..e7f4dd8e 100644 --- a/src/build/arg_group.rs +++ b/src/build/arg_group.rs @@ -469,7 +469,7 @@ impl<'a> From<&'a yaml_rust::yaml::Hash> for ArgGroup<'a> { // We WANT this to panic on error...so expect() is good. let mut a = ArgGroup::default(); let group_settings = if b.len() == 1 { - let name_yml = b.keys().nth(0).expect("failed to get name"); + let name_yml = b.keys().next().expect("failed to get name"); let name_str = name_yml .as_str() .expect("failed to convert arg YAML name to str"); diff --git a/src/macros.rs b/src/macros.rs index e97a4b3a..2c89da0e 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -759,7 +759,7 @@ macro_rules! clap_app { $crate::clap_app!{ @arg ($arg.long(stringify!($long))) $modes $($tail)* } }; (@arg ($arg:expr) $modes:tt -$short:ident $($tail:tt)*) => { - $crate::clap_app!{ @arg ($arg.short(stringify!($short).chars().nth(0).unwrap())) $modes $($tail)* } + $crate::clap_app!{ @arg ($arg.short(stringify!($short).chars().next().unwrap())) $modes $($tail)* } }; (@arg ($arg:expr) (-) <$var:ident> $($tail:tt)*) => { $crate::clap_app!{ @arg ($arg.value_name(stringify!($var))) (+) +takes_value +required $($tail)* }