@@ -51,15 +51,6 @@ use std::hash::{Hash, SipHasher, Hasher};
5151use syntax:: ast;
5252use 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 ) ]
6455pub struct Svh {
6556 raw : u64 ,
@@ -68,7 +59,7 @@ pub struct Svh {
6859impl 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
137124impl 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