Commit 7881b743 authored by Kornel's avatar Kornel

Ignore yanked

parent ee9c35d3
[package]
name = "cargo-upgrades"
version = "1.1.0"
version = "1.1.1"
authors = ["Kornel <[email protected]>"]
categories = ["development-tools::cargo-plugins"]
repository = "https://gitlab.com/kornelski/cargo-upgrades"
......
......@@ -98,7 +98,10 @@ impl Workspace {
return None;
}
let c = index.crate_(dep.name.as_str())?;
let versions: Vec<_> = c.versions().iter().filter_map(|v| Version::parse(v.version()).ok()).collect();
let versions: Vec<_> = c.versions().iter()
.filter(|v| !v.is_yanked())
.filter_map(|v| Version::parse(v.version()).ok())
.collect();
let latest_stable = versions.iter().filter(|v| v.pre.is_empty()).max();
let latest_unstable = versions.iter().filter(|v| !v.pre.is_empty()).max();
let latest_usable = latest_stable.or(latest_unstable)?;
......
use cargo_upgrades::*;
fn main() {
// When run via Cargo, the command name is present
let args: Vec<_> = std::env::args().collect();
......@@ -12,7 +11,7 @@ fn main() {
Err(e) => {
eprintln!("cargo-upgrades v{}\n{}\nUsage: {} --manifest-path=Cargo.toml", env!("CARGO_PKG_VERSION"), e, args[0]);
std::process::exit(1);
}
},
};
let manifest_path = matches.opt_str("manifest-path");
......@@ -21,7 +20,7 @@ fn main() {
Err(e) => {
eprintln!("error: {}", e);
std::process::exit(1);
}
},
};
let mut printed_anything = false;
......@@ -34,7 +33,13 @@ fn main() {
let matches = d.matches.map(|s| s.to_string());
let dep = d.dependency;
let req = dep.req.to_string();
println!(" {} {} matches {}; latest is {}", dep.name, req.trim_start_matches('^'), matches.as_ref().map(|s| s.as_str()).unwrap_or("nothing"), d.latest);
println!(
" {} {} matches {}; latest is {}",
dep.name,
req.trim_start_matches('^'),
matches.as_ref().map(|s| s.as_str()).unwrap_or("nothing"),
d.latest
);
}
printed_anything = true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment