Use semver parser instead of regex
This commit is contained in:
parent
b486960720
commit
b0859c3e2f
1 changed files with 2 additions and 2 deletions
|
@ -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),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue