Skip to content

Commit

Permalink
Merge pull request clap-rs#2472 from ldm0/master
Browse files Browse the repository at this point in the history
Fix clippy errors and warnings
  • Loading branch information
pksunkara authored May 8, 2021
2 parents df69011 + 2a921d4 commit 73cf47a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion clap_derive/tests/special_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn special_types_bool() {
Ok(self::bool(s.into()))
}
}
};
}

#[derive(Clap, PartialEq, Debug)]
struct Opt {
Expand Down
10 changes: 3 additions & 7 deletions src/parse/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
}
}
8 changes: 7 additions & 1 deletion tests/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 73cf47a

Please sign in to comment.