Skip to content

Commit dd41732

Browse files
committed
rustc_back: Remove unused code
Downstream consumers of Svh now use the ToString and Hash traits whenever possible
1 parent 75219e1 commit dd41732

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

Diff for: src/librustc_back/svh.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ use std::hash::{Hash, SipHasher, Hasher};
5151
use syntax::ast;
5252
use syntax::visit;
5353

54-
fn hex(b: u64) -> char {
55-
let b = (b & 0xf) as u8;
56-
let b = match b {
57-
0 ... 9 => '0' as u8 + b,
58-
_ => 'a' as u8 + b - 10,
59-
};
60-
b as char
61-
}
62-
6354
#[derive(Clone, PartialEq, Eq, Debug)]
6455
pub struct Svh {
6556
raw: u64,
@@ -68,7 +59,7 @@ pub struct Svh {
6859
impl Svh {
6960
pub fn new(hash: &str) -> Svh {
7061
assert!(hash.len() == 16);
71-
// Ideally we'd just reverse the nibbles on LE machines during as_string, unfortunately
62+
// Ideally we'd just reverse the nibbles on LE machines during to_string, unfortunately
7263
// this would break the abi so I guess we're just doing this now.
7364

7465
let s = if cfg!(target_endian = "big") {
@@ -82,10 +73,6 @@ impl Svh {
8273
}
8374
}
8475

85-
pub fn as_string(&self) -> String {
86-
(0..64).step_by(4).map(|i| hex(self.raw >> i)).collect()
87-
}
88-
8976
pub fn calculate(metadata: &Vec<String>, krate: &ast::Crate) -> Svh {
9077
// FIXME (#14132): This is better than it used to be, but it still not
9178
// ideal. We now attempt to hash only the relevant portions of the
@@ -136,7 +123,7 @@ impl Hash for Svh {
136123

137124
impl fmt::Display for Svh {
138125
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
139-
f.pad(&self.as_string())
126+
f.pad(&self.to_string())
140127
}
141128
}
142129

0 commit comments

Comments
 (0)