diff --git a/src/cli.rs b/src/cli.rs index fc370e8..6ffd278 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -112,7 +112,7 @@ impl Cli { } pub fn get_matches_and_try_parse() -> Result<(Self, ArgMatches), clap::Error> { - Self::get_matches_and_try_parse_from(&std::env::args_os) + Self::get_matches_and_try_parse_from(std::env::args_os) } pub fn extra_metadata(&self, matches: &ArgMatches) -> Vec { @@ -210,12 +210,7 @@ impl TypedValueParser for AutoReqModeParser { let inner = PossibleValuesParser::new(VALUES.iter().map(|(k, _v)| k)); match inner.parse_ref(cmd, arg, value) { - Ok(name) => Ok(VALUES - .iter() - .find(|(k, _v)| name.as_str() == (k.as_ref() as &str)) - .unwrap() - .1 - .clone()), + Ok(name) => Ok(VALUES.iter().find(|(k, _v)| name.eq(k)).unwrap().1.clone()), Err(e) if e.kind() == clap::error::ErrorKind::InvalidValue => { let inner = PathBufValueParser::new(); match inner.parse_ref(cmd, arg, value) { diff --git a/src/config/mod.rs b/src/config/mod.rs index 5de5a66..d8de4cb 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -86,7 +86,7 @@ impl Config { pub(crate) fn create_cargo_toml_path>(base_path: P) -> Result { let path = base_path.as_ref().join("Cargo.toml"); - path.canonicalize().or_else(|e| Err(Error::FileIo(path, e))) + path.canonicalize().map_err(|e| Error::FileIo(path, e)) } fn table_to_dependencies(table: &Table) -> Result, ConfigError> { diff --git a/src/error.rs b/src/error.rs index b369fc2..97f4298 100644 --- a/src/error.rs +++ b/src/error.rs @@ -71,6 +71,7 @@ pub enum Error { #[error(transparent)] Config(#[from] ConfigError), #[error("Invalid value of enviroment variable {0}: {1}")] + #[allow(clippy::enum_variant_names)] // Allow bad terminology for compatibility EnvError(&'static str, String), #[error(transparent)] ParseTomlFile(#[from] FileAnnotatedError),