Skip to content

Commit e024029

Browse files
committed
Remove unnecessary cloning
1 parent dcd8f4a commit e024029

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backends/wasm_js.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ fn inner(crypto: &Crypto, dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
4545
// The chunk can be smaller than buf's length, so we call to
4646
// JS to create a smaller view of buf without allocation.
4747
let sub_buf = if chunk_len == u32::from(MAX_BUFFER_SIZE) {
48-
buf.clone()
48+
&buf
4949
} else {
50-
buf.subarray(0, chunk_len)
50+
&buf.subarray(0, chunk_len)
5151
};
5252

53-
if crypto.get_random_values(&sub_buf).is_err() {
53+
if crypto.get_random_values(sub_buf).is_err() {
5454
return Err(Error::WEB_GET_RANDOM_VALUES);
5555
}
5656

0 commit comments

Comments
 (0)