Skip to content

Commit d8936af

Browse files
authored
Auto merge of #3142 - alexcrichton:siphash, r=alexcrichton
Allow deprecated use of SipHasher This type is being deprecated in rust-lang/rust#36815, so allow use of the deprecated type for now. We can fix this later once new APIs have landed.
2 parents cbe47ed + 3af7890 commit d8936af

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/cargo/sources/git/source.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::fmt::{self, Debug, Formatter};
2-
use std::hash::{Hash, Hasher, SipHasher};
32

43
use url::Url;
54

65
use core::source::{Source, SourceId};
76
use core::GitReference;
87
use core::{Package, PackageId, Summary, Registry, Dependency};
9-
use util::{CargoResult, Config, to_hex};
8+
use util::{CargoResult, Config};
9+
use util::hex::short_hash;
1010
use sources::PathSource;
1111
use sources::git::utils::{GitRemote, GitRevision};
1212

@@ -57,8 +57,6 @@ impl<'cfg> GitSource<'cfg> {
5757
}
5858

5959
fn ident(url: &Url) -> String {
60-
let mut hasher = SipHasher::new_with_keys(0,0);
61-
6260
let url = canonicalize_url(url);
6361
let ident = url.path_segments().and_then(|mut s| s.next_back()).unwrap_or("");
6462

@@ -68,8 +66,7 @@ fn ident(url: &Url) -> String {
6866
ident
6967
};
7068

71-
url.hash(&mut hasher);
72-
format!("{}-{}", ident, to_hex(hasher.finish()))
69+
format!("{}-{}", ident, short_hash(&url))
7370
}
7471

7572
// Some hacks and heuristics for making equivalent URLs hash the same

src/cargo/util/hex.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(deprecated)]
2+
13
use std::hash::{Hasher, Hash, SipHasher};
24

35
use rustc_serialize::hex::ToHex;

0 commit comments

Comments
 (0)