@@ -147,7 +147,12 @@ impl MudaAdapter {
147147 Box :: new ( muda:: PredefinedMenuItem :: separator ( ) )
148148 } else if !entry. has_sub_menu {
149149 let accelerator = keys_to_accelerator ( & entry. shortcut )
150- . map_err ( |_err| eprintln ! ( "Warning: Failed to convert shortcut {} to native shortcut" , entry. shortcut) )
150+ . map_err ( |_err| {
151+ eprintln ! (
152+ "Warning: Failed to convert shortcut {} to native shortcut" ,
153+ entry. shortcut
154+ )
155+ } )
151156 . unwrap_or ( None ) ;
152157
153158 // the top level always has a sub menu regardless of entry.has_sub_menu
@@ -174,7 +179,12 @@ impl MudaAdapter {
174179 accelerator,
175180 ) )
176181 } else {
177- Box :: new ( muda:: MenuItem :: with_id ( id. clone ( ) , & entry. title , entry. enabled , accelerator) )
182+ Box :: new ( muda:: MenuItem :: with_id (
183+ id. clone ( ) ,
184+ & entry. title ,
185+ entry. enabled ,
186+ accelerator,
187+ ) )
178188 }
179189 } else {
180190 let sub_menu = muda:: Submenu :: with_id ( id. clone ( ) , & entry. title , entry. enabled ) ;
@@ -309,11 +319,13 @@ fn key_string_to_code(string: &str) -> Option<muda::accelerator::Code> {
309319 "y" => Some ( KeyY ) ,
310320 "z" => Some ( KeyZ ) ,
311321 "=" => Some ( Equal ) ,
312- _ => None
322+ _ => None ,
313323 }
314324}
315325
316- fn keys_to_accelerator ( keys : & i_slint_core:: input:: Keys ) -> Result < Option < muda:: accelerator:: Accelerator > , ( ) > {
326+ fn keys_to_accelerator (
327+ keys : & i_slint_core:: input:: Keys ,
328+ ) -> Result < Option < muda:: accelerator:: Accelerator > , ( ) > {
317329 use muda:: accelerator:: * ;
318330
319331 if * keys == i_slint_core:: input:: Keys :: default ( ) {
@@ -353,7 +365,6 @@ fn keys_to_accelerator(keys: &i_slint_core::input::Keys) -> Result<Option<muda::
353365 Ok ( Some ( Accelerator :: new ( Some ( modifiers) , key) ) )
354366}
355367
356-
357368fn install_event_handler_if_necessary ( proxy : EventLoopProxy < SlintEvent > ) {
358369 // `MenuEvent::set_event_handler()` in `muda` seems to use `OnceCell`, which is an
359370 // can only be set a single time. Therefore, we need to take care to only call this
0 commit comments