mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 23:04:23 +00:00
Merge pull request #2472 from ldm0/master
Fix clippy errors and warnings
This commit is contained in:
commit
73cf47a533
3 changed files with 11 additions and 9 deletions
|
@ -17,7 +17,7 @@ fn special_types_bool() {
|
|||
Ok(self::bool(s.into()))
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Clap, PartialEq, Debug)]
|
||||
struct Opt {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")]
|
||||
|
|
Loading…
Reference in a new issue