Skip to content

Commit 8fcdd87

Browse files
committed
fix format
1 parent 8c0cc9b commit 8fcdd87

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

bindings/wasm/src/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1+
use js_sys::Function;
12
use serde::Serialize;
3+
use std::cell::RefCell;
4+
use std::rc::Rc;
25
use wasm_bindgen::{
36
prelude::{wasm_bindgen, JsError},
4-
JsValue,
5-
JsCast,
7+
JsCast, JsValue,
68
};
7-
use js_sys::Function;
8-
use std::cell::RefCell;
9-
use std::rc::Rc;
109

1110
use ironcalc_base::{
1211
expressions::{lexer::util::get_tokens as tokenizer, types::Area, utils::number_to_column},
@@ -99,11 +98,11 @@ impl Model {
9998
}
10099
}
101100
});
102-
101+
103102
// Store subscription in an Rc<RefCell<>> so it can be moved into the closure
104103
let subscription_rc = Rc::new(RefCell::new(Some(subscription)));
105104
let subscription_clone = subscription_rc.clone();
106-
105+
107106
// Create the unsubscribe function
108107
let unsubscribe_fn = wasm_bindgen::closure::Closure::wrap(Box::new(move || {
109108
if let Ok(mut sub) = subscription_clone.try_borrow_mut() {
@@ -112,10 +111,10 @@ impl Model {
112111
}
113112
}
114113
}) as Box<dyn FnMut()>);
115-
114+
116115
let js_function = unsubscribe_fn.as_ref().unchecked_ref::<Function>().clone();
117116
unsubscribe_fn.forget(); // Prevent the closure from being dropped
118-
117+
119118
js_function
120119
}
121120

0 commit comments

Comments
 (0)