diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2015-02-01 21:53:25 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2015-02-05 13:45:01 -0500 |
| commit | 17bc7d8d5be3be9674d702ccad2fa88c487d23b0 (patch) | |
| tree | 325defba0f55b48273cd3f0814fe6c083dee5d41 /src/libcoretest | |
| parent | 2c05354211b04a52cc66a0b8ad8b2225eaf9e972 (diff) | |
| download | rust-17bc7d8d5be3be9674d702ccad2fa88c487d23b0.tar.gz rust-17bc7d8d5be3be9674d702ccad2fa88c487d23b0.zip | |
cleanup: replace `as[_mut]_slice()` calls with deref coercions
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/char.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/hash/sip.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs index 2e29b1c41c4..9ba9c2c4a9c 100644 --- a/src/libcoretest/char.rs +++ b/src/libcoretest/char.rs @@ -166,7 +166,7 @@ fn test_escape_unicode() { fn test_encode_utf8() { fn check(input: char, expect: &[u8]) { let mut buf = [0u8; 4]; - let n = input.encode_utf8(buf.as_mut_slice()).unwrap_or(0); + let n = input.encode_utf8(&mut buf).unwrap_or(0); assert_eq!(&buf[..n], expect); } @@ -180,7 +180,7 @@ fn test_encode_utf8() { fn test_encode_utf16() { fn check(input: char, expect: &[u16]) { let mut buf = [0u16; 2]; - let n = input.encode_utf16(buf.as_mut_slice()).unwrap_or(0); + let n = input.encode_utf16(&mut buf).unwrap_or(0); assert_eq!(&buf[..n], expect); } diff --git a/src/libcoretest/hash/sip.rs b/src/libcoretest/hash/sip.rs index a493f71925e..248cad32ef4 100644 --- a/src/libcoretest/hash/sip.rs +++ b/src/libcoretest/hash/sip.rs @@ -110,7 +110,7 @@ fn test_siphash() { fn to_hex_str(r: &[u8; 8]) -> String { let mut s = String::new(); for b in r { - s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); + s.push_str(format!("{}", fmt::radix(*b, 16))); } s } @@ -131,7 +131,7 @@ fn test_siphash() { let r = result_bytes(h); let mut s = String::new(); for b in &r { - s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice()); + s.push_str(format!("{}", fmt::radix(*b, 16))); } s } @@ -139,12 +139,12 @@ fn test_siphash() { while t < 64 { debug!("siphash test {}: {}", t, buf); let vec = u8to64_le!(vecs[t], 0); - let out = hash_with_keys(k0, k1, &Bytes(buf.as_slice())); + let out = hash_with_keys(k0, k1, &Bytes(buf)); debug!("got {}, expected {}", out, vec); assert_eq!(vec, out); state_full.reset(); - state_full.write(buf.as_slice()); + state_full.write(buf); let f = result_str(state_full.result()); let i = result_str(state_inc.result()); let v = to_hex_str(&vecs[t]); |
