Fix a lint warning on nightly

Signed-off-by: eternal-flame-AD <yume@yumechi.jp>
This commit is contained in:
ゆめ 2024-10-11 21:26:51 -05:00
parent 056468ca52
commit 13dad10e10
No known key found for this signature in database

View file

@ -28,7 +28,7 @@ pub fn unitdc_input(input: String) -> Result<(), JsValue> {
#[wasm_bindgen] #[wasm_bindgen]
pub fn unitdc_init(js_output: Function) { pub fn unitdc_init(js_output: Function) {
unsafe { unsafe {
INTERPRETER = Some(Interpreter::new(Box::new(move |output| match output { let mut interp = Interpreter::new(Box::new(move |output| match output {
Output::Quantity(q) => { Output::Quantity(q) => {
js_output js_output
.call2( .call2(
@ -52,12 +52,13 @@ pub fn unitdc_init(js_output: Function) {
.call2(&JsValue::NULL, &JsValue::from("message"), &JsValue::from(e)) .call2(&JsValue::NULL, &JsValue::from("message"), &JsValue::from(e))
.unwrap(); .unwrap();
} }
}))); }));
INTERPRETER
.as_mut() interp
.unwrap()
.run_str(include_str!("../../../unitdc.rc")) .run_str(include_str!("../../../unitdc.rc"))
.unwrap(); .expect("could not run initialization script");
INTERPRETER = Some(interp);
} }
} }