diff options
| author | Erick Tryzelaar <[email protected]> | 2013-12-18 07:30:16 -0800 |
|---|---|---|
| committer | Erick Tryzelaar <[email protected]> | 2013-12-18 07:30:16 -0800 |
| commit | 4e0257ab5991eaa6863d261f97dcf6ff8e6b7545 (patch) | |
| tree | d58c184dae0040a0afbf9f4b8e8eb83e72cef314 /hex.rs | |
| parent | Integrate with Travis (diff) | |
| parent | Update for latest rustc (0.9-pre ca54ad8) (diff) | |
| download | rust-openssl-4e0257ab5991eaa6863d261f97dcf6ff8e6b7545.tar.xz rust-openssl-4e0257ab5991eaa6863d261f97dcf6ff8e6b7545.zip | |
Merge branch 'master' of https://github.com/kballard/rustcrypto
Diffstat (limited to 'hex.rs')
| -rw-r--r-- | hex.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -20,10 +20,10 @@ pub trait ToHex { fn to_hex(&self) -> ~str; } -impl<'self> ToHex for &'self [u8] { +impl<'a> ToHex for &'a [u8] { fn to_hex(&self) -> ~str { - let chars = "0123456789ABCDEF".iter().collect::<~[char]>(); + let chars = "0123456789ABCDEF".chars().collect::<~[char]>(); let mut s = ~""; @@ -46,11 +46,11 @@ pub trait FromHex { fn from_hex(&self) -> ~[u8]; } -impl<'self> FromHex for &'self str { +impl<'a> FromHex for &'a str { fn from_hex(&self) -> ~[u8] { let mut vec = vec::with_capacity(self.len() / 2); - for (i,c) in self.iter().enumerate() { + for (i,c) in self.chars().enumerate() { let nibble = if c >= '0' && c <= '9' { (c as u8) - 0x30 } else if c >= 'a' && c <= 'f' { (c as u8) - (0x61 - 10) } |