about summary refs log tree commit diff
path: root/src/libcoretest/num
diff options
context:
space:
mode:
authorUlrik Sverdrup <bluss@users.noreply.github.com>2016-02-23 19:25:43 +0100
committerUlrik Sverdrup <bluss@users.noreply.github.com>2016-02-26 14:51:38 +0100
commit2d6496dd8432c71b65d67c7216fbd4428c06527b (patch)
treee82e379131bb08248dc4d625b19a3a53673957d4 /src/libcoretest/num
parent09130044ce7429beb95742afa7fd371960dbe607 (diff)
downloadrust-2d6496dd8432c71b65d67c7216fbd4428c06527b.tar.gz
rust-2d6496dd8432c71b65d67c7216fbd4428c06527b.zip
Use .copy_from_slice() where applicable
.copy_from_slice() does the same job of .clone_from_slice(), but the
former is explicitly for Copy elements and calls `memcpy` directly, and
thus is it efficient without optimization too.
Diffstat (limited to 'src/libcoretest/num')
-rw-r--r--src/libcoretest/num/flt2dec/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcoretest/num/flt2dec/mod.rs b/src/libcoretest/num/flt2dec/mod.rs
index 48a5501acb7..1a592f3ad42 100644
--- a/src/libcoretest/num/flt2dec/mod.rs
+++ b/src/libcoretest/num/flt2dec/mod.rs
@@ -100,7 +100,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
 
     // check significant digits
     for i in 1..cut.unwrap_or(expected.len() - 1) {
-        expected_[..i].clone_from_slice(&expected[..i]);
+        expected_[..i].copy_from_slice(&expected[..i]);
         let mut expectedk_ = expectedk;
         if expected[i] >= b'5' {
             // check if this is a rounding-to-even case.
@@ -147,7 +147,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
     // check infinite zero digits
     if let Some(cut) = cut {
         for i in cut..expected.len()-1 {
-            expected_[..cut].clone_from_slice(&expected[..cut]);
+            expected_[..cut].copy_from_slice(&expected[..cut]);
             for c in &mut expected_[cut..i] { *c = b'0'; }
 
             try_exact!(f(&decoded) => &mut buf, &expected_[..i], expectedk;