Skip to content

Commit 26497a3

Browse files
committed
refactor(util): Align VersionExt, PartialVersion naming
1 parent 6e5afab commit 26497a3

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/cargo/core/package_id_spec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl PackageIdSpec {
153153

154154
/// Full `semver::Version`, if present
155155
pub fn version(&self) -> Option<Version> {
156-
self.version.as_ref().and_then(|v| v.version())
156+
self.version.as_ref().and_then(|v| v.to_version())
157157
}
158158

159159
pub fn partial_version(&self) -> Option<&PartialVersion> {

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ pub fn create_bcx<'a, 'cfg>(
493493
continue;
494494
};
495495

496-
let req = version.caret_req();
496+
let req = version.to_caret_req();
497497
if req.matches(&untagged_version) {
498498
continue;
499499
}

src/cargo/ops/common_for_install_and_uninstall.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ where
555555
match deps.iter().max_by_key(|p| p.package_id()) {
556556
Some(summary) => {
557557
if let (Some(current), Some(msrv)) = (current_rust_version, summary.rust_version()) {
558-
let msrv_req = msrv.caret_req();
558+
let msrv_req = msrv.to_caret_req();
559559
if !msrv_req.matches(current) {
560560
let name = summary.name();
561561
let ver = summary.version();
@@ -574,7 +574,7 @@ where
574574
.filter(|summary| {
575575
summary
576576
.rust_version()
577-
.map(|msrv| msrv.caret_req().matches(current))
577+
.map(|msrv| msrv.to_caret_req().matches(current))
578578
.unwrap_or(true)
579579
})
580580
.max_by_key(|s| s.package_id())

src/cargo/util/semver_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub struct PartialVersion {
201201
}
202202

203203
impl PartialVersion {
204-
pub fn version(&self) -> Option<Version> {
204+
pub fn to_version(&self) -> Option<Version> {
205205
Some(Version {
206206
major: self.major,
207207
minor: self.minor?,
@@ -211,7 +211,7 @@ impl PartialVersion {
211211
})
212212
}
213213

214-
pub fn caret_req(&self) -> VersionReq {
214+
pub fn to_caret_req(&self) -> VersionReq {
215215
VersionReq {
216216
comparators: vec![Comparator {
217217
op: semver::Op::Caret,

src/cargo/util/toml/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ impl schema::TomlManifest {
568568
let rust_version = rust_version
569569
.clone()
570570
.resolve("rust_version", || inherit()?.rust_version())?;
571-
let req = rust_version.caret_req();
571+
let req = rust_version.to_caret_req();
572572
if let Some(first_version) = edition.first_version() {
573573
let unsupported =
574574
semver::Version::new(first_version.major, first_version.minor - 1, 9999);

0 commit comments

Comments
 (0)