mirror of
https://github.com/sergi0g/cup.git
synced 2025-11-17 09:33:38 -05:00
Fix a few more clippy lints
This commit is contained in:
@@ -81,39 +81,31 @@ impl Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_status(&self, base: &Self) -> Status {
|
pub fn to_status(&self, base: &Self) -> Status {
|
||||||
if self.major > base.major {
|
match self.major.cmp(&base.major) {
|
||||||
Status::UpdateMajor
|
Ordering::Greater => Status::UpdateMajor,
|
||||||
} else if self.major == base.major {
|
Ordering::Equal => match (self.minor, base.minor) {
|
||||||
match (self.minor, base.minor) {
|
(Some(a_minor), Some(b_minor)) => match a_minor.cmp(&b_minor) {
|
||||||
(Some(a_minor), Some(b_minor)) => {
|
Ordering::Greater => Status::UpdateMinor,
|
||||||
if a_minor > b_minor {
|
Ordering::Equal => match (self.patch, base.patch) {
|
||||||
Status::UpdateMinor
|
(Some(a_patch), Some(b_patch)) => match a_patch.cmp(&b_patch) {
|
||||||
} else if a_minor == b_minor {
|
Ordering::Greater => Status::UpdatePatch,
|
||||||
match (self.patch, base.patch) {
|
Ordering::Equal => Status::UpToDate,
|
||||||
(Some(a_patch), Some(b_patch)) => {
|
Ordering::Less => {
|
||||||
if a_patch > b_patch {
|
|
||||||
Status::UpdatePatch
|
|
||||||
} else if a_patch == b_patch {
|
|
||||||
Status::UpToDate
|
|
||||||
} else {
|
|
||||||
Status::Unknown(format!("Tag {} does not exist", base))
|
Status::Unknown(format!("Tag {} does not exist", base))
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
(None, None) => Status::UpToDate,
|
(None, None) => Status::UpToDate,
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
},
|
||||||
} else {
|
Ordering::Less => Status::Unknown(format!("Tag {} does not exist", base)),
|
||||||
Status::Unknown(format!("Tag {} does not exist", base))
|
},
|
||||||
}
|
|
||||||
}
|
|
||||||
(None, None) => Status::UpToDate,
|
(None, None) => Status::UpToDate,
|
||||||
_ => unreachable!(
|
_ => unreachable!(
|
||||||
"Version error: {} and {} should either both be Some or None",
|
"Version error: {} and {} should either both be Some or None",
|
||||||
self, base
|
self, base
|
||||||
),
|
),
|
||||||
}
|
},
|
||||||
} else {
|
Ordering::Less => Status::Unknown(format!("Tag {} does not exist", base)),
|
||||||
Status::Unknown(format!("Tag {} does not exist", base))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user