aboutsummaryrefslogtreecommitdiff
path: root/hex.rs
diff options
context:
space:
mode:
Diffstat (limited to 'hex.rs')
-rw-r--r--hex.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/hex.rs b/hex.rs
index 2193e49c..abd62e8a 100644
--- a/hex.rs
+++ b/hex.rs
@@ -34,10 +34,8 @@ impl<'self> ToHex for &'self [u8] {
let xhi = (x >> 4) & 0x0F;
let xlo = (x ) & 0x0F;
- unsafe {
- str::push_char(&mut s, chars[xhi]);
- str::push_char(&mut s, chars[xlo]);
- }
+ str::push_char(&mut s, chars[xhi]);
+ str::push_char(&mut s, chars[xlo]);
}
s
@@ -61,9 +59,7 @@ impl<'self> FromHex for &'self str {
else { fail!(~"bad hex character"); };
if i % 2 == 0 {
- unsafe {
- vec::push(&mut vec, nibble << 4);
- }
+ vec::push(&mut vec, nibble << 4);
}
else {
vec[i/2] |= nibble;
@@ -89,4 +85,4 @@ mod tests {
}
-} \ No newline at end of file
+}