From b0859c3e2fb97cedddb25428dc50aa1dbfe52bb9 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 18 Jan 2016 22:34:41 +0100 Subject: [PATCH] Use semver parser instead of regex --- libimagstore/src/header.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libimagstore/src/header.rs b/libimagstore/src/header.rs index 74f8b748..9cd8362c 100644 --- a/libimagstore/src/header.rs +++ b/libimagstore/src/header.rs @@ -138,7 +138,7 @@ fn has_main_section(t: &Table) -> bool { } fn has_imag_version_in_main_section(t: &Table) -> bool { - use regex::Regex; + use semver::Version; match t.get("imag").unwrap() { &Value::Table(ref sec) => { @@ -146,7 +146,7 @@ fn has_imag_version_in_main_section(t: &Table) -> bool { .and_then(|v| { match v { &Value::String(ref s) => { - Some(Regex::new(r"^\d{1}\.\d{1}\.\d{1}(.*)").unwrap().is_match(&s[..])) + Some(Version::parse(&s[..]).is_ok()) }, _ => Some(false), }