Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 3a108fc

Browse files
committed
Auto merge of #212 - JohnTitor:bump-cargo-and-semver, r=Xanewok
Upgrade the `cargo` and `semver` crates r? `@Xanewok`
2 parents 82f36de + 103584c commit 3a108fc

File tree

3 files changed

+62
-32
lines changed

3 files changed

+62
-32
lines changed

Cargo.lock

Lines changed: 34 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ license-file = "LICENSE"
1111
edition = "2018"
1212

1313
[dependencies]
14-
cargo = "0.54"
14+
cargo = "0.55"
1515
crates-io = "0.33" # Keep in sync with version pulled by Cargo
1616
curl = "0.4.38"
1717
env_logger = "0.9"
1818
anyhow = "1.0.42"
1919
log = "0.4"
20-
semver = "0.10" # Keep in sync with version pulled by Cargo
20+
semver = "1.0" # Keep in sync with version pulled by Cargo
2121
serde = { version = "1.0.127", features = ["derive"] }
2222
serde_json = "1.0.66"
2323

src/changes.rs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc_middle::ty::{error::TypeError, Predicate};
1414
use rustc_session::Session;
1515
use rustc_span::symbol::Symbol;
1616
use rustc_span::{FileName, Span};
17-
use semver::Version;
17+
use semver::{BuildMetadata, Prerelease, Version};
1818
use std::{
1919
cmp::Ordering,
2020
collections::{BTreeMap, BTreeSet, HashMap},
@@ -1088,12 +1088,12 @@ impl<'tcx> ChangeSet<'tcx> {
10881088
fn get_new_version(&self, version: &str) -> Option<String> {
10891089
if let Ok(mut new_version) = Version::parse(version) {
10901090
if new_version.major == 0 {
1091-
new_version.increment_patch();
1091+
increment_patch(&mut new_version);
10921092
} else {
10931093
match self.max {
1094-
Patch => new_version.increment_patch(),
1095-
NonBreaking | TechnicallyBreaking => new_version.increment_minor(),
1096-
Breaking => new_version.increment_major(),
1094+
Patch => increment_patch(&mut new_version),
1095+
NonBreaking | TechnicallyBreaking => increment_minor(&mut new_version),
1096+
Breaking => increment_major(&mut new_version),
10971097
}
10981098
}
10991099

@@ -1700,3 +1700,24 @@ pub mod tests {
17001700
}
17011701
}
17021702
}
1703+
1704+
fn increment_patch(v: &mut Version) {
1705+
v.patch += 1;
1706+
v.pre = Prerelease::EMPTY;
1707+
v.build = BuildMetadata::EMPTY;
1708+
}
1709+
1710+
fn increment_minor(v: &mut Version) {
1711+
v.minor += 1;
1712+
v.patch = 0;
1713+
v.pre = Prerelease::EMPTY;
1714+
v.build = BuildMetadata::EMPTY;
1715+
}
1716+
1717+
fn increment_major(v: &mut Version) {
1718+
v.major += 1;
1719+
v.minor = 0;
1720+
v.patch = 0;
1721+
v.pre = Prerelease::EMPTY;
1722+
v.build = BuildMetadata::EMPTY;
1723+
}

0 commit comments

Comments
 (0)