fix lintting

This commit is contained in:
Jean-Marie Mineau 2023-02-26 12:43:14 +01:00 committed by Jean-Marie Mineau
parent 323e77b4e4
commit c4442e2741
2 changed files with 36 additions and 30 deletions

View file

@ -71,19 +71,18 @@ fn update_letters() {
while let Some(child) = result.first_element_child() {
child.remove();
}
DICTIONNARY
if let Some(anagrms) = DICTIONNARY
.lock()
.expect("Failed to access DICTIONNARY")
.as_ref()
.map(|dict| dict.find(&val))
.flatten()
.map(|anagrms| {
for anagram in anagrms {
let val = document().create_element("li").unwrap();
val.set_text_content(Some(&anagram));
result.append_child(&val).unwrap();
}
});
.and_then(|dict| dict.find(&val))
{
for anagram in anagrms {
let val = document().create_element("li").unwrap();
val.set_text_content(Some(&anagram));
result.append_child(&val).unwrap();
}
};
}
fn load_dict(text: JsValue) {
@ -113,8 +112,8 @@ fn load_dict(text: JsValue) {
// Called when the wasm module is instantiated
#[wasm_bindgen(start)]
fn main() -> Result<(), JsValue> {
let load_dict_c1 = Closure::<dyn FnMut(_)>::new(move |text: JsValue| load_dict(text));
let load_dict_c2 = Closure::<dyn FnMut(_)>::new(move |text: JsValue| load_dict(text));
let load_dict_c1 = Closure::<dyn FnMut(_)>::new(load_dict);
let load_dict_c2 = Closure::<dyn FnMut(_)>::new(load_dict);
let update_dict = Closure::<dyn FnMut(_)>::new(move |event: Event| {
display_spinner();