Skip to content

Commit 8020e69

Browse files
committed
fix: dependencies and lint
1 parent 70fb7e1 commit 8020e69

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

crates/bitwarden-threading/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ serde = { workspace = true }
1919
serde_json = { workspace = true }
2020
thiserror = { workspace = true }
2121
tokio = { features = ["sync", "time", "rt"], workspace = true }
22+
tokio-util = { version = "0.7.15" }
2223

2324
[target.'cfg(target_arch="wasm32")'.dependencies]
2425
gloo-timers = { version = "0.3.0", features = ["futures"], optional = true }
2526
js-sys = { workspace = true }
26-
tokio-util = { version = "0.7.15" }
2727
tsify-next = { workspace = true }
2828
wasm-bindgen = { workspace = true }
2929
wasm-bindgen-futures = { workspace = true }

crates/bitwarden-threading/src/time.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ mod test {
1919
#[wasm_bindgen_test]
2020
#[allow(dead_code)] // Not actually dead, but rust-analyzer doesn't understand `wasm_bindgen_test`
2121
async fn should_sleep_wasm() {
22-
use super::*;
2322
use js_sys::Date;
2423

24+
use super::*;
25+
2526
console_error_panic_hook::set_once();
2627
let start = Date::now();
2728

@@ -36,9 +37,10 @@ mod test {
3637
// #[cfg(not(target_arch = "wasm32"))]
3738
#[tokio::test]
3839
async fn should_sleep_tokio() {
39-
use super::*;
4040
use std::time::Instant;
4141

42+
use super::*;
43+
4244
let start = Instant::now();
4345

4446
sleep(Duration::from_millis(100)).await;

crates/bitwarden-threading/tests/cancellation_token/wasm.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
use bitwarden_threading::cancellation_token::{
2-
wasm::{AbortController, AbortControllerExt, CancellationTokenExt},
3-
CancellationToken,
4-
};
5-
use bitwarden_threading::time::sleep;
61
use std::time::Duration;
2+
3+
use bitwarden_threading::{
4+
cancellation_token::{
5+
wasm::{AbortController, AbortControllerExt, CancellationTokenExt},
6+
CancellationToken,
7+
},
8+
time::sleep,
9+
};
710
use wasm_bindgen::externref_heap_live_count;
811
use wasm_bindgen_test::wasm_bindgen_test;
912

@@ -145,7 +148,8 @@ mod to_bidirectional_abort_controller {
145148
// Dropping the token should the internal strong reference to the JS object, leaving us
146149
// with only the strong reference that was returned to the caller.
147150
// We check this because the reference is kept within a spawn_local future and it'll only be
148-
// dropped when the future is dropped. And the future needs to be dropped or we'll leak memory.
151+
// dropped when the future is dropped. And the future needs to be dropped or we'll leak
152+
// memory.
149153
assert_eq!(
150154
heap_count_after_dropping_guard,
151155
heap_count_after_creating_abort_controller - 1,
@@ -292,7 +296,8 @@ mod to_bidirectional_cancellation_token {
292296
// Dropping the token should the internal strong reference to the JS object, leaving us
293297
// with only the strong reference that was returned to the caller.
294298
// We check this because the reference is kept within a spawn_local future and it'll only be
295-
// dropped when the future is dropped. And the future needs to be dropped or we'll leak memory.
299+
// dropped when the future is dropped. And the future needs to be dropped or we'll leak
300+
// memory.
296301
assert_eq!(
297302
heap_count_after_dropping_guard, heap_count_before_creating_cancellation_token,
298303
"Dropping the token should drop the internal strong reference to the JS object"

0 commit comments

Comments
 (0)