From 2b17216a7ce30d629f7638ea2cb5a913cb391867 Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 1 Apr 2020 21:07:50 +0100 Subject: Version-specific deprecation --- deps_index/src/index.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'deps_index') diff --git a/deps_index/src/index.rs b/deps_index/src/index.rs index 99c6637..4d7e90f 100644 --- a/deps_index/src/index.rs +++ b/deps_index/src/index.rs @@ -390,7 +390,7 @@ impl Index { /// 0 = not used *or deprecated* /// 1 = everyone uses it pub async fn version_popularity(&self, crate_name: &str, requirement: &VersionReq) -> Result, DepsErr> { - if is_deprecated(crate_name) { + if is_deprecated(crate_name, requirement) { return Ok(Some((false, 0.))); } @@ -448,11 +448,13 @@ impl fmt::Debug for Dep { } } -/// TODO: check if the repo is rust-lang-deprecated. -/// Note: the repo URL in the crate is outdated, and it may be a redirect to the deprecated -pub fn is_deprecated(name: &str) -> bool { +pub fn is_deprecated(name: &str, requirement: &VersionReq) -> bool { + let v02 = "0.2.99".parse().unwrap(); + let v01 = "0.1.99".parse().unwrap(); match name { - "rustc-serialize" | "gcc" | "rustc-benchmarks" | "time" | "rust-crypto" | + "time" if requirement.matches(&v01) => true, + "winapi" if requirement.matches(&v01) || requirement.matches(&v02) => true, + "rustc-serialize" | "gcc" | "rustc-benchmarks" | "rust-crypto" | "flate2-crc" | "complex" | "simple_stats" | "concurrent" | "feed" | "isatty" | "thread-scoped" | "target_build_utils" | "chan" | "chan-signal" | "glsl-to-spirv" => true, -- cgit v1.2.3