aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/platform/version.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/platform/version.rs')
-rw-r--r--crates/shirabe/src/platform/version.rs35
1 files changed, 23 insertions, 12 deletions
diff --git a/crates/shirabe/src/platform/version.rs b/crates/shirabe/src/platform/version.rs
index 5c64098..a9566ee 100644
--- a/crates/shirabe/src/platform/version.rs
+++ b/crates/shirabe/src/platform/version.rs
@@ -15,7 +15,10 @@ impl Version {
)?;
let patch = if version_compare(&matches["version"], "3.0.0", "<") {
- format!(".{}", Self::convert_alpha_version_to_int_version(&matches["patch"]))
+ format!(
+ ".{}",
+ Self::convert_alpha_version_to_int_version(&matches["patch"])
+ )
} else {
String::new()
};
@@ -25,25 +28,33 @@ impl Version {
.replace("-fips", "")
.replace("-pre", "-alpha");
- Some(format!("{}{}{}", matches["version"], patch, suffix).trim_end_matches('-').to_string())
+ Some(
+ format!("{}{}{}", matches["version"], patch, suffix)
+ .trim_end_matches('-')
+ .to_string(),
+ )
}
pub fn parse_libjpeg(libjpeg_version: &str) -> Option<String> {
- let matches = Preg::match_strict_groups(
- r"^(?P<major>\d+)(?P<minor>[a-z]*)$",
- libjpeg_version,
- )?;
+ let matches =
+ Preg::match_strict_groups(r"^(?P<major>\d+)(?P<minor>[a-z]*)$", libjpeg_version)?;
- Some(format!("{}.{}", matches["major"], Self::convert_alpha_version_to_int_version(&matches["minor"])))
+ Some(format!(
+ "{}.{}",
+ matches["major"],
+ Self::convert_alpha_version_to_int_version(&matches["minor"])
+ ))
}
pub fn parse_zoneinfo_version(zoneinfo_version: &str) -> Option<String> {
- let matches = Preg::match_strict_groups(
- r"^(?P<year>\d{4})(?P<revision>[a-z]*)$",
- zoneinfo_version,
- )?;
+ let matches =
+ Preg::match_strict_groups(r"^(?P<year>\d{4})(?P<revision>[a-z]*)$", zoneinfo_version)?;
- Some(format!("{}.{}", matches["year"], Self::convert_alpha_version_to_int_version(&matches["revision"])))
+ Some(format!(
+ "{}.{}",
+ matches["year"],
+ Self::convert_alpha_version_to_int_version(&matches["revision"])
+ ))
}
fn convert_alpha_version_to_int_version(alpha: &str) -> i64 {