aboutsummaryrefslogtreecommitdiff
path: root/hex.rs
diff options
context:
space:
mode:
authorKevin Ballard <[email protected]>2013-05-10 20:22:14 -0700
committerKevin Ballard <[email protected]>2013-05-10 20:22:14 -0700
commit4e79896c962699e92e29bba97a07987cf26dec25 (patch)
treeca62dd4c9f9ff1313c0412f744ad8fa62e5bb7b4 /hex.rs
parentTweak for rust trunk (c081ffb 2013-04-30 02:21:37 -0700) (diff)
downloadrust-openssl-4e79896c962699e92e29bba97a07987cf26dec25.tar.xz
rust-openssl-4e79896c962699e92e29bba97a07987cf26dec25.zip
Remove unnecessary `unsafe` blocks
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
+}