From d96e53d00665d4ad207935277c54173dbe9875d3 Mon Sep 17 00:00:00 2001 From: Nicolas Sarlin Date: Thu, 18 Jul 2024 16:58:33 +0200 Subject: [PATCH] fix: ignore pre-release for version comparison --- src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index c259638..169ef48 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,6 +4,7 @@ use std::{ path::{Path, PathBuf}, }; +use semver::Prerelease; #[cfg(feature = "load")] use semver::{Version, VersionReq}; #[cfg(feature = "load")] @@ -394,7 +395,10 @@ pub struct Testcase { #[cfg(feature = "load")] impl Testcase { pub fn is_valid_for_version(&self, version: &str) -> bool { - let tfhe_version = Version::parse(version).unwrap(); + let mut tfhe_version = Version::parse(version).unwrap(); + + // Removes the pre-release tag because matches will always return + tfhe_version.pre = Prerelease::EMPTY; let req = format!(">={}", self.tfhe_version_min); let min_version = VersionReq::parse(&req).unwrap();