Skip to content

Commit

Permalink
Auto merge of #3142 - alexcrichton:siphash, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors authored Sep 30, 2016
2 parents cbe47ed + 3af7890 commit d8936af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cargo/sources/git/source.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher, SipHasher};

use url::Url;

use core::source::{Source, SourceId};
use core::GitReference;
use core::{Package, PackageId, Summary, Registry, Dependency};
use util::{CargoResult, Config, to_hex};
use util::{CargoResult, Config};
use util::hex::short_hash;
use sources::PathSource;
use sources::git::utils::{GitRemote, GitRevision};

Expand Down Expand Up @@ -57,8 +57,6 @@ impl<'cfg> GitSource<'cfg> {
}

fn ident(url: &Url) -> String {
let mut hasher = SipHasher::new_with_keys(0,0);

let url = canonicalize_url(url);
let ident = url.path_segments().and_then(|mut s| s.next_back()).unwrap_or("");

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

url.hash(&mut hasher);
format!("{}-{}", ident, to_hex(hasher.finish()))
format!("{}-{}", ident, short_hash(&url))
}

// Some hacks and heuristics for making equivalent URLs hash the same
Expand Down
2 changes: 2 additions & 0 deletions src/cargo/util/hex.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

use std::hash::{Hasher, Hash, SipHasher};

use rustc_serialize::hex::ToHex;
Expand Down

0 comments on commit d8936af

Please sign in to comment.