@@ -51,15 +51,6 @@ use std::hash::{Hash, SipHasher, Hasher};
51
51
use syntax:: ast;
52
52
use syntax:: visit;
53
53
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
-
63
54
#[ derive( Clone , PartialEq , Eq , Debug ) ]
64
55
pub struct Svh {
65
56
raw : u64 ,
@@ -68,7 +59,7 @@ pub struct Svh {
68
59
impl Svh {
69
60
pub fn new ( hash : & str ) -> Svh {
70
61
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
72
63
// this would break the abi so I guess we're just doing this now.
73
64
74
65
let s = if cfg ! ( target_endian = "big" ) {
@@ -82,10 +73,6 @@ impl Svh {
82
73
}
83
74
}
84
75
85
- pub fn as_string ( & self ) -> String {
86
- ( 0 ..64 ) . step_by ( 4 ) . map ( |i| hex ( self . raw >> i) ) . collect ( )
87
- }
88
-
89
76
pub fn calculate ( metadata : & Vec < String > , krate : & ast:: Crate ) -> Svh {
90
77
// FIXME (#14132): This is better than it used to be, but it still not
91
78
// ideal. We now attempt to hash only the relevant portions of the
@@ -136,7 +123,7 @@ impl Hash for Svh {
136
123
137
124
impl fmt:: Display for Svh {
138
125
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
139
- f. pad ( & self . as_string ( ) )
126
+ f. pad ( & self . to_string ( ) )
140
127
}
141
128
}
142
129
0 commit comments