Skip to content

Commit cf72d6c

Browse files
daxpeddanewpavlov
andcommitted
Remove the js_sys::Uint8Array import
Co-Authored-By: Artyom Pavlov <[email protected]>
1 parent ec6f289 commit cf72d6c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/backends/wasm_js.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ pub use crate::util::{inner_u32, inner_u64};
77
#[cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))]
88
compile_error!("`wasm_js` backend can be enabled only for OS-less WASM targets!");
99

10-
#[cfg(target_feature = "atomics")]
11-
use js_sys::Uint8Array;
1210
use wasm_bindgen::{prelude::wasm_bindgen, JsValue};
1311

1412
// Maximum buffer size allowed in `Crypto.getRandomValuesSize` is 65536 bytes.
@@ -40,7 +38,7 @@ fn inner(crypto: &Crypto, dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
4038
let buf_len_u32 = buf_len
4139
.try_into()
4240
.expect("buffer length is bounded by MAX_BUFFER_SIZE");
43-
let buf = Uint8Array::new_with_length(buf_len_u32);
41+
let buf = js_sys::Uint8Array::new_with_length(buf_len_u32);
4442
for chunk in dest.chunks_mut(buf_len) {
4543
let chunk_len = chunk
4644
.len()
@@ -77,5 +75,5 @@ extern "C" {
7775
fn get_random_values(this: &Crypto, buf: &mut [MaybeUninit<u8>]) -> Result<(), JsValue>;
7876
#[cfg(target_feature = "atomics")]
7977
#[wasm_bindgen(method, js_name = getRandomValues, catch)]
80-
fn get_random_values(this: &Crypto, buf: &Uint8Array) -> Result<(), JsValue>;
78+
fn get_random_values(this: &Crypto, buf: &js_sys::Uint8Array) -> Result<(), JsValue>;
8179
}

0 commit comments

Comments
 (0)