Skip to content

Commit a317456

Browse files
committed
to_str_radix() is deprecated
1 parent 7170201 commit a317456

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/rust-crypto/digest.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::num::ToStrRadix;
12-
1311
/**
1412
* The Digest trait specifies an interface common to digest functions, such as SHA-1 and the SHA-2
1513
* family of digest functions.
@@ -81,10 +79,7 @@ pub trait Digest {
8179
fn to_hex(rr: &[u8]) -> String {
8280
let mut s = String::new();
8381
for b in rr.iter() {
84-
let hex = (*b as uint).to_str_radix(16u);
85-
if hex.len() == 1 {
86-
s.push_char('0');
87-
}
82+
let hex = format!("{:02x}", *b);
8883
s.push_str(hex.as_slice());
8984
}
9085
return s;

0 commit comments

Comments
 (0)