Merge pull request #2472 from ldm0/master

Fix clippy errors and warnings
This commit is contained in:
Pavan Kumar Sunkara 2021-05-08 09:39:07 +01:00 committed by GitHub
commit 73cf47a533
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View file

@ -17,7 +17,7 @@ fn special_types_bool() {
Ok(self::bool(s.into()))
}
}
};
}
#[derive(Clap, PartialEq, Debug)]
struct Opt {

View file

@ -401,7 +401,7 @@ pub struct Error {
/// Additional information depending on the error kind, like values and argument names.
/// Useful when you want to render an error of your own.
pub info: Vec<String>,
pub(crate) source: Option<Box<dyn error::Error + Send + Sync>>,
pub(crate) source: Option<Box<dyn error::Error>>,
}
impl Display for Error {
@ -794,7 +794,7 @@ impl Error {
pub(crate) fn value_validation(
arg: String,
val: String,
err: Box<dyn error::Error + Send + Sync>,
err: Box<dyn error::Error>,
color: ColorChoice,
) -> Self {
let mut c = Colorizer::new(true, color);
@ -981,10 +981,6 @@ impl From<fmt::Error> for Error {
impl error::Error for Error {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
if let Some(source) = self.source.as_deref() {
Some(source)
} else {
None
}
self.source.as_deref()
}
}

View file

@ -115,7 +115,13 @@ fn yaml_multiple_values() {
let matches = App::from(yaml)
.try_get_matches_from(vec!["prog", "-s", "aaa", "bbb"])
.unwrap();
assert_eq!(matches.values_of("settings").unwrap().collect::<Vec<&str>>(), vec!["aaa", "bbb"]);
assert_eq!(
matches
.values_of("settings")
.unwrap()
.collect::<Vec<&str>>(),
vec!["aaa", "bbb"]
);
}
#[cfg(feature = "regex")]