~timvisee/version-compare

8678a335008b1cf5b60304e0442f9428daf9ea52 — timvisee 1 year, 8 months ago 71b8488
Resolve clippy warnings
3 files changed, 5 insertions(+), 5 deletions(-)

M src/cmp.rs
M src/compare.rs
M src/version.rs
M src/cmp.rs => src/cmp.rs +2 -2
@@ 60,7 60,7 @@ impl Cmp {
    /// assert_eq!(Cmp::from_sign("  >=   "), Ok(Cmp::Ge));
    /// assert!(Cmp::from_sign("*").is_err());
    /// ```
    #[allow(clippy::result_unit_err)]
    #[allow(clippy::result_map_unit_fn)]
    pub fn from_sign<S: AsRef<str>>(sign: S) -> Result<Cmp, ()> {
        match sign.as_ref().trim() {
            "==" | "=" => Ok(Cmp::Eq),


@@ 87,7 87,7 @@ impl Cmp {
    /// assert_eq!(Cmp::from_name("  Ge   "), Ok(Cmp::Ge));
    /// assert!(Cmp::from_name("abc").is_err());
    /// ```
    #[allow(clippy::result_unit_err)]
    #[allow(clippy::result_map_unit_fn)]
    pub fn from_name<S: AsRef<str>>(sign: S) -> Result<Cmp, ()> {
        match sign.as_ref().trim().to_lowercase().as_str() {
            "eq" => Ok(Cmp::Eq),

M src/compare.rs => src/compare.rs +2 -2
@@ 25,7 25,7 @@ use crate::Cmp;
/// assert_eq!(compare("1.2.3", "1.2.4"), Ok(Cmp::Lt));
/// assert_eq!(compare("1", "0.1"), Ok(Cmp::Gt));
/// ```
#[allow(clippy::result_unit_err)]
#[allow(clippy::result_map_unit_fn)]
pub fn compare<A, B>(a: A, b: B) -> Result<Cmp, ()>
where
    A: AsRef<str>,


@@ 52,7 52,7 @@ where
/// assert!(compare_to("1", "0.1", Cmp::Gt).unwrap());
/// assert!(compare_to("1", "0.1", Cmp::Ge).unwrap());
/// ```
#[allow(clippy::result_unit_err)]
#[allow(clippy::result_map_unit_fn)]
pub fn compare_to<A, B>(a: A, b: B, operator: Cmp) -> Result<bool, ()>
where
    A: AsRef<str>,

M src/version.rs => src/version.rs +1 -1
@@ 187,7 187,7 @@ impl<'a> Version<'a> {
    /// assert_eq!(ver.part(1), Ok(Part::Number(2)));
    /// assert_eq!(ver.part(2), Ok(Part::Number(3)));
    /// ```
    #[allow(clippy::result_unit_err)]
    #[allow(clippy::result_map_unit_fn)]
    pub fn part(&self, index: usize) -> Result<Part<'a>, ()> {
        // Make sure the index is in-bound
        if index >= self.parts.len() {