Fix clippy and bump MSRV

This commit is contained in:
CreepySkeleton 2020-03-13 21:26:45 +03:00
parent 1cff11109e
commit b61a807728
7 changed files with 11 additions and 11 deletions

View file

@ -14,7 +14,7 @@ stages:
jobs:
- job:
variables:
rust: 1.36.0
rust: 1.40.0
strategy:
matrix:
Windows 32-bit (MSVC):

View file

@ -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

View file

@ -5,7 +5,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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();

View file

@ -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())
};

View file

@ -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

View file

@ -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");

View file

@ -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)* }