diff options
| author | bors <bors@rust-lang.org> | 2016-02-27 01:15:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-02-27 01:15:23 +0000 |
| commit | f1e191c0b959111aef19f3aa06b7f1743419470c (patch) | |
| tree | 489b5291ae5e28a7be0b051978ae1c1fd7f047ef /src/libstd/sys | |
| parent | 98a8a71236453a16f0048a65506f4d0bea042ca5 (diff) | |
| parent | 2d6496dd8432c71b65d67c7216fbd4428c06527b (diff) | |
| download | rust-f1e191c0b959111aef19f3aa06b7f1743419470c.tar.gz rust-f1e191c0b959111aef19f3aa06b7f1743419470c.zip | |
Auto merge of #31914 - bluss:copy-from-slice-everywhere, r=alexcrichton
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/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 68ba2fe20b4..48e9adb9296 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -341,7 +341,7 @@ impl Wtf8Buf { Some((surrogate_pos, _)) => { pos = surrogate_pos + 3; self.bytes[surrogate_pos..pos] - .clone_from_slice(UTF8_REPLACEMENT_CHARACTER); + .copy_from_slice(UTF8_REPLACEMENT_CHARACTER); }, None => return unsafe { String::from_utf8_unchecked(self.bytes) } } |
