Skip to content

Commit 79f3512

Browse files
committed
Renames SourceId::into_url -> SourceId::as_url
While studying the source code, I am surprised to see that `into_url` does not actually consume the string when a function with such name usually does. Additionally, there are traits in `cargo::util::IntoUrl` with the same and does exactly what you expect, consumes T and yields a `Url`. I hope this is not too nitpicky. Thank you!
1 parent ab32ee8 commit 79f3512

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/cargo/core/package_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl ser::Serialize for PackageId {
5858
"{} {} ({})",
5959
self.inner.name,
6060
self.inner.version,
61-
self.inner.source_id.into_url()
61+
self.inner.source_id.as_url()
6262
))
6363
}
6464
}

src/cargo/core/resolver/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ impl fmt::Display for EncodablePackageId {
500500
write!(f, " {}", s)?;
501501
}
502502
if let Some(s) = &self.source {
503-
write!(f, " ({})", s.into_url())?;
503+
write!(f, " ({})", s.as_url())?;
504504
}
505505
Ok(())
506506
}

src/cargo/core/source/source_id.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl SourceId {
144144
}
145145

146146
/// A view of the `SourceId` that can be `Display`ed as a URL.
147-
pub fn into_url(&self) -> SourceIdIntoUrl<'_> {
147+
pub fn as_url(&self) -> SourceIdIntoUrl<'_> {
148148
SourceIdIntoUrl {
149149
inner: &*self.inner,
150150
}
@@ -445,7 +445,7 @@ impl ser::Serialize for SourceId {
445445
if self.is_path() {
446446
None::<String>.serialize(s)
447447
} else {
448-
s.collect_str(&self.into_url())
448+
s.collect_str(&self.as_url())
449449
}
450450
}
451451
}

0 commit comments

Comments
 (0)