Skip to content

Commit

Permalink
rustc_back: Remove unused code
Browse files Browse the repository at this point in the history
Downstream consumers of Svh now use the ToString and Hash traits
whenever possible
  • Loading branch information
richo committed Jun 28, 2015
1 parent 75219e1 commit dd41732
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/librustc_back/svh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ use std::hash::{Hash, SipHasher, Hasher};
use syntax::ast;
use syntax::visit;

fn hex(b: u64) -> char {
let b = (b & 0xf) as u8;
let b = match b {
0 ... 9 => '0' as u8 + b,
_ => 'a' as u8 + b - 10,
};
b as char
}

#[derive(Clone, PartialEq, Eq, Debug)]
pub struct Svh {
raw: u64,
Expand All @@ -68,7 +59,7 @@ pub struct Svh {
impl Svh {
pub fn new(hash: &str) -> Svh {
assert!(hash.len() == 16);
// Ideally we'd just reverse the nibbles on LE machines during as_string, unfortunately
// Ideally we'd just reverse the nibbles on LE machines during to_string, unfortunately
// this would break the abi so I guess we're just doing this now.

let s = if cfg!(target_endian = "big") {
Expand All @@ -82,10 +73,6 @@ impl Svh {
}
}

pub fn as_string(&self) -> String {
(0..64).step_by(4).map(|i| hex(self.raw >> i)).collect()
}

pub fn calculate(metadata: &Vec<String>, krate: &ast::Crate) -> Svh {
// FIXME (#14132): This is better than it used to be, but it still not
// ideal. We now attempt to hash only the relevant portions of the
Expand Down Expand Up @@ -136,7 +123,7 @@ impl Hash for Svh {

impl fmt::Display for Svh {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.pad(&self.as_string())
f.pad(&self.to_string())
}
}

Expand Down

0 comments on commit dd41732

Please sign in to comment.