summaryrefslogtreecommitdiffstats
path: root/deps_index
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-04-01 21:07:50 +0100
committerKornel <kornel@geekhood.net>2020-04-01 21:08:36 +0100
commit2b17216a7ce30d629f7638ea2cb5a913cb391867 (patch)
treecb0c999d208cab1ef1abdef75c4a28599a4ca5f5 /deps_index
parent29a8bee0382ec2ba3a1e019b1ffee4b65fcc78a8 (diff)
Version-specific deprecation
Diffstat (limited to 'deps_index')
-rw-r--r--deps_index/src/index.rs12
1 files changed, 7 insertions, 5 deletions
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<Option<(bool, f32)>, 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,