mirror of
https://github.com/rust-lang/cargo
synced 2024-08-27 19:29:21 +00:00
Use semver::Version's cmp_precedence for deciding what is downgrade
This commit is contained in:
parent
985e1eeef5
commit
c0ed70ef5e
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -2886,9 +2886,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "1.0.19"
|
version = "1.0.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0"
|
checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
|
@ -76,7 +76,7 @@ rand = "0.8.5"
|
||||||
rustfix = "0.6.1"
|
rustfix = "0.6.1"
|
||||||
same-file = "1.0.6"
|
same-file = "1.0.6"
|
||||||
security-framework = "2.9.2"
|
security-framework = "2.9.2"
|
||||||
semver = { version = "1.0.19", features = ["serde"] }
|
semver = { version = "1.0.20", features = ["serde"] }
|
||||||
serde = "1.0.188"
|
serde = "1.0.188"
|
||||||
serde-untagged = "0.1.1"
|
serde-untagged = "0.1.1"
|
||||||
serde-value = "0.7.0"
|
serde-value = "0.7.0"
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::util::config::Config;
|
||||||
use crate::util::style;
|
use crate::util::style;
|
||||||
use crate::util::CargoResult;
|
use crate::util::CargoResult;
|
||||||
use anstyle::Style;
|
use anstyle::Style;
|
||||||
|
use std::cmp::Ordering;
|
||||||
use std::collections::{BTreeMap, HashSet};
|
use std::collections::{BTreeMap, HashSet};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
|
@ -156,11 +157,7 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes
|
||||||
// regardless of whether the build metadata has gone up or down.
|
// regardless of whether the build metadata has gone up or down.
|
||||||
// This metadata is often stuff like git commit hashes, which are
|
// This metadata is often stuff like git commit hashes, which are
|
||||||
// not meaningfully ordered.
|
// not meaningfully ordered.
|
||||||
let removed = removed[0].version();
|
if removed[0].version().cmp_precedence(added[0].version()) == Ordering::Greater {
|
||||||
let added = added[0].version();
|
|
||||||
if (removed.major, removed.minor, removed.patch, &removed.pre)
|
|
||||||
> (added.major, added.minor, added.patch, &added.pre)
|
|
||||||
{
|
|
||||||
print_change("Downgrading", msg, &style::WARN)?;
|
print_change("Downgrading", msg, &style::WARN)?;
|
||||||
} else {
|
} else {
|
||||||
print_change("Updating", msg, &style::GOOD)?;
|
print_change("Updating", msg, &style::GOOD)?;
|
||||||
|
|
Loading…
Reference in a new issue