Skip to content

Commit 88ff1c9

Browse files
committed
simplify SourceID Hash
1 parent 79866e1 commit 88ff1c9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cargo/core/source_id.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,12 @@ impl fmt::Display for SourceId {
666666
}
667667

668668
/// The hash of SourceId is used in the name of some Cargo folders, so shouldn't
669-
/// vary. `as_str` gives the serialisation of a url (which has a spec) and so
669+
/// vary. [`CanonicalUrl`] uses `as_str`, the serialisation of a url (which has a spec), and so
670670
/// insulates against possible changes in how the url crate does hashing.
671671
impl Hash for SourceId {
672672
fn hash<S: hash::Hasher>(&self, into: &mut S) {
673673
self.inner.kind.hash(into);
674-
match self.inner.kind {
675-
SourceKind::Git(_) => self.inner.canonical_url.hash(into),
676-
_ => self.inner.url.as_str().hash(into),
677-
}
674+
self.inner.canonical_url.hash(into);
678675
}
679676
}
680677

0 commit comments

Comments
 (0)