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.
This commit is contained in:
@@ -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) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user