@@ -46,7 +46,7 @@ pub async fn run_script(
4646 workspace_name,
4747 )
4848 . await
49- . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {}" , e ) ) ?;
49+ . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {e}" ) ) ?;
5050 log_info ( & format ! (
5151 "Using workspace: {} at path: {}" ,
5252 workspace_name,
@@ -67,7 +67,7 @@ pub async fn run_script(
6767 workspace_name,
6868 )
6969 . await
70- . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {}" , e ) ) ?
70+ . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {e}" ) ) ?
7171 } else {
7272 std:: env:: current_dir ( ) . context ( "Failed to get current directory" ) ?
7373 } ,
@@ -96,16 +96,14 @@ pub async fn run_script(
9696 log_command ( pre_script, "" ) ;
9797 ScriptService :: execute_custom_script ( & package, & pre_script_name, pre_script)
9898 . await
99- . map_err ( |e| {
100- anyhow:: anyhow!( "Failed to execute pre script {}: {}" , pre_script_name, e)
101- } ) ?;
99+ . map_err ( |e| anyhow:: anyhow!( "Failed to execute pre script {pre_script_name}: {e}" ) ) ?;
102100 }
103101
104102 // Execute main script
105103 let script_content = if let Some ( Value :: String ( content) ) = scripts. get ( script_name) {
106104 content
107105 } else {
108- anyhow:: bail!( "Script '{}' not found in package.json" , script_name ) ;
106+ anyhow:: bail!( "Script '{script_name }' not found in package.json" ) ;
109107 } ;
110108
111109 let script_args = script_args. unwrap_or_default ( ) ;
@@ -117,7 +115,7 @@ pub async fn run_script(
117115 script_args,
118116 )
119117 . await
120- . map_err ( |e| anyhow:: anyhow!( "Failed to execute script {}: {}" , script_name , e ) ) ?;
118+ . map_err ( |e| anyhow:: anyhow!( "Failed to execute script {script_name }: {e}" ) ) ?;
121119
122120 // Execute post script if exists
123121 let post_script_name = format ! ( "post{script_name}" ) ;
@@ -126,7 +124,7 @@ pub async fn run_script(
126124 ScriptService :: execute_custom_script ( & package, & post_script_name, post_script)
127125 . await
128126 . map_err ( |e| {
129- anyhow:: anyhow!( "Failed to execute post script {}: {}" , post_script_name , e )
127+ anyhow:: anyhow!( "Failed to execute post script {post_script_name }: {e}" )
130128 } ) ?;
131129 }
132130
@@ -263,7 +261,7 @@ pub async fn run_script_in_all_workspaces(
263261 match result {
264262 Ok ( task_result) => results. push ( task_result) ,
265263 Err ( join_error) => {
266- return Err ( anyhow:: anyhow!( "Task join error: {}" , join_error ) ) ;
264+ return Err ( anyhow:: anyhow!( "Task join error: {join_error}" ) ) ;
267265 }
268266 }
269267 }
@@ -372,26 +370,6 @@ mod tests {
372370 assert ! ( topology. is_empty( ) ) ;
373371 }
374372
375- #[ tokio:: test]
376- async fn test_run_script_in_all_workspaces_no_workspaces ( ) {
377- let _dir = tempdir ( ) . unwrap ( ) ;
378- let package_json = r#"
379- {
380- "name": "test-project",
381- "version": "1.0.0",
382- "scripts": {
383- "test": "echo test"
384- }
385- }"# ;
386-
387- fs:: write ( _dir. path ( ) . join ( "package.json" ) , package_json) . unwrap ( ) ;
388- std:: env:: set_current_dir ( _dir. path ( ) ) . unwrap ( ) ;
389-
390- let result = run_script_in_all_workspaces ( "test" , None ) . await ;
391- // Should succeed but do nothing when no workspaces exist
392- assert ! ( result. is_ok( ) ) ;
393- }
394-
395373 #[ tokio:: test]
396374 #[ allow( unused_variables) ]
397375 async fn test_need_run_with_script ( ) {
0 commit comments