diff --git a/lib/entry/libimagentryfilter/src/builtin/header/version/eq.rs b/lib/entry/libimagentryfilter/src/builtin/header/version/eq.rs index 138d1da0..0a56c751 100644 --- a/lib/entry/libimagentryfilter/src/builtin/header/version/eq.rs +++ b/lib/entry/libimagentryfilter/src/builtin/header/version/eq.rs @@ -21,7 +21,7 @@ use semver::Version; use libimagstore::store::Entry; -use toml_query::read::TomlValueReadExt; +use toml_query::read::TomlValueReadTypeExt; use filters::filter::Filter; pub struct VersionEq { @@ -40,13 +40,9 @@ impl Filter for VersionEq { fn filter(&self, e: &Entry) -> bool { e.get_header() - .read("imag.version") + .read_string("imag.version") .map(|val| { - val.map_or(false, |v| { - v.as_str() - .map(|s| Version::parse(s).map(|v| v == self.version).unwrap_or(false)) - .unwrap_or(false) - }) + val.map_or(false, |s| Version::parse(&s).map(|v| v == self.version).unwrap_or(false)) }) .unwrap_or(false) } diff --git a/lib/entry/libimagentryfilter/src/builtin/header/version/gt.rs b/lib/entry/libimagentryfilter/src/builtin/header/version/gt.rs index edc89145..c4afbded 100644 --- a/lib/entry/libimagentryfilter/src/builtin/header/version/gt.rs +++ b/lib/entry/libimagentryfilter/src/builtin/header/version/gt.rs @@ -21,7 +21,7 @@ use semver::Version; use libimagstore::store::Entry; -use toml_query::read::TomlValueReadExt; +use toml_query::read::TomlValueReadTypeExt; use filters::filter::Filter; pub struct VersionGt { @@ -40,13 +40,9 @@ impl Filter for VersionGt { fn filter(&self, e: &Entry) -> bool { e.get_header() - .read("imag.version") + .read_string("imag.version") .map(|val| { - val.map_or(false, |v| { - v.as_str() - .map(|s| Version::parse(s).map(|v| v > self.version).unwrap_or(false)) - .unwrap_or(false) - }) + val.map_or(false, |s| Version::parse(&s).map(|v| v > self.version).unwrap_or(false)) }) .unwrap_or(false) } diff --git a/lib/entry/libimagentryfilter/src/builtin/header/version/lt.rs b/lib/entry/libimagentryfilter/src/builtin/header/version/lt.rs index 846c7f62..38b5000b 100644 --- a/lib/entry/libimagentryfilter/src/builtin/header/version/lt.rs +++ b/lib/entry/libimagentryfilter/src/builtin/header/version/lt.rs @@ -21,7 +21,7 @@ use semver::Version; use libimagstore::store::Entry; -use toml_query::read::TomlValueReadExt; +use toml_query::read::TomlValueReadTypeExt; use filters::filter::Filter; pub struct VersionLt { @@ -40,13 +40,9 @@ impl Filter for VersionLt { fn filter(&self, e: &Entry) -> bool { e.get_header() - .read("imag.version") + .read_string("imag.version") .map(|val| { - val.map_or(false, |v| { - v.as_str() - .map(|s| Version::parse(s).map(|v| v < self.version).unwrap_or(false)) - .unwrap_or(false) - }) + val.map_or(false, |s| Version::parse(&s).map(|v| v < self.version).unwrap_or(false)) }) .unwrap_or(false) }