From a6cf640ccc8378b9cf44f520ea145351671729ef Mon Sep 17 00:00:00 2001 From: xlfish233 <446304319@qq.com> Date: Fri, 26 Sep 2025 13:55:51 +0800 Subject: [PATCH] fix: fix cant handle =xxx --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/version/comparison.rs | 1 + src/version/core.rs | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e90619e..a755c2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,7 +129,7 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cargo-stale" -version = "0.1.4" +version = "0.1.5" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index 8b60870..8452359 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-stale" -version = "0.1.4" +version = "0.1.5" edition = "2024" description = "A fast, concurrent tool to check for outdated dependencies in your Rust Cargo.toml file" license = "MIT" diff --git a/src/version/comparison.rs b/src/version/comparison.rs index f37d532..5a1bdda 100644 --- a/src/version/comparison.rs +++ b/src/version/comparison.rs @@ -30,5 +30,6 @@ mod tests { assert!(!is_version_outdated("0.7.1", "0.5.92")); assert!(is_version_outdated("4.0.0-rc.3", "4.0.0")); assert!(!is_version_outdated("4.0.0", "4.0.0+build.123")); + assert!(!is_version_outdated("=0.7.3", "0.7.3")); } } diff --git a/src/version/core.rs b/src/version/core.rs index 566fdd4..ca5ea7a 100644 --- a/src/version/core.rs +++ b/src/version/core.rs @@ -12,6 +12,11 @@ pub struct Version { impl Version { pub fn parse(version_str: &str) -> Option { let version_str = version_str.trim(); + let version_str = if let Some(stripped) = version_str.strip_prefix('=') { + stripped + } else { + version_str + }; let (core_version, pre_and_build) = if let Some(pos) = version_str.find('-') { (&version_str[..pos], Some(&version_str[pos + 1..]))