@@ -73,9 +73,7 @@ impl LuaPlugin {
7373
7474 fn has_function ( & self , name : & str ) -> Result < bool , PluginError > {
7575 Ok ( !matches ! (
76- self . plugin_table
77- . get:: <Value >( name)
78- . into_plugin_result( ) ?,
76+ self . plugin_table. get:: <Value >( name) . into_plugin_result( ) ?,
7977 Value :: Nil
8078 ) )
8179 }
@@ -93,14 +91,8 @@ impl LuaPlugin {
9391 where
9492 T : serde:: Serialize ,
9593 {
96- let function: Function = self
97- . plugin_table
98- . get ( hook_name)
99- . into_plugin_result ( ) ?;
100- let ctx_value = self
101- . lua
102- . to_value ( ctx)
103- . into_plugin_result ( ) ?;
94+ let function: Function = self . plugin_table . get ( hook_name) . into_plugin_result ( ) ?;
95+ let ctx_value = self . lua . to_value ( ctx) . into_plugin_result ( ) ?;
10496 function
10597 . call :: < MultiValue > ( ( self . plugin_table . clone ( ) , ctx_value) )
10698 . into_plugin_result ( )
@@ -126,10 +118,8 @@ impl Plugin for LuaPlugin {
126118 }
127119
128120 fn install_plan ( & self , version : & str ) -> Result < InstallPlan , PluginError > {
129- let result: PreInstallHookResult = self . call_hook (
130- "PreInstall" ,
131- & PreInstallHookCtx { version } ,
132- ) ?;
121+ let result: PreInstallHookResult =
122+ self . call_hook ( "PreInstall" , & PreInstallHookCtx { version } ) ?;
133123 let resolved_version = result. version . unwrap_or_else ( || version. to_string ( ) ) ;
134124 let main_name = result
135125 . name
@@ -270,10 +260,7 @@ impl Plugin for LuaPlugin {
270260 . get ( "ParseLegacyFile" )
271261 . into_plugin_result ( ) ?;
272262
273- let ctx = self
274- . lua
275- . create_table ( )
276- . into_plugin_result ( ) ?;
263+ let ctx = self . lua . create_table ( ) . into_plugin_result ( ) ?;
277264 ctx. set ( "filepath" , file_path. display ( ) . to_string ( ) )
278265 . into_plugin_result ( ) ?;
279266 ctx. set ( "filename" , file_name. to_string ( ) )
@@ -324,10 +311,7 @@ impl Plugin for LuaPlugin {
324311 name : runtime. main . name . clone ( ) ,
325312 note : runtime. main . note . clone ( ) ,
326313 } ;
327- let _ = self . call_hook_raw (
328- "PreUninstall" ,
329- & PreUninstallHookCtx { main, sdk_info } ,
330- ) ?;
314+ let _ = self . call_hook_raw ( "PreUninstall" , & PreUninstallHookCtx { main, sdk_info } ) ?;
331315 Ok ( ( ) )
332316 }
333317}
@@ -349,8 +333,7 @@ where
349333 if matches ! ( first, Value :: Nil ) {
350334 return Err ( PluginError :: NoResultProvided ) ;
351335 }
352- lua. from_value ( first)
353- . into_plugin_result ( )
336+ lua. from_value ( first) . into_plugin_result ( )
354337}
355338
356339fn parse_install_source (
@@ -451,9 +434,7 @@ fn set_runtime_globals(lua: &Lua, source: &Path) -> Result<(), PluginError> {
451434 . set ( "ARCH_TYPE" , runtime_arch_type ( ) )
452435 . into_plugin_result ( ) ?;
453436
454- let runtime = lua
455- . create_table ( )
456- . into_plugin_result ( ) ?;
437+ let runtime = lua. create_table ( ) . into_plugin_result ( ) ?;
457438 runtime
458439 . set ( "osType" , runtime_os_type ( ) )
459440 . into_plugin_result ( ) ?;
@@ -466,9 +447,7 @@ fn set_runtime_globals(lua: &Lua, source: &Path) -> Result<(), PluginError> {
466447 runtime
467448 . set ( "pluginDirPath" , source. display ( ) . to_string ( ) )
468449 . into_plugin_result ( ) ?;
469- globals
470- . set ( "RUNTIME" , runtime)
471- . into_plugin_result ( )
450+ globals. set ( "RUNTIME" , runtime) . into_plugin_result ( )
472451}
473452
474453fn load_plugin_scripts ( lua : & Lua , source : & Path ) -> Result < ( ) , PluginError > {
0 commit comments