@@ -31,8 +31,8 @@ pub async fn execute_job(job: &Job, sot_path: &Path, runner: &RunnerConfig) -> b
3131 let mut last_result: Option < CommandResult > = None ;
3232
3333 for attempt in 0 ..max_attempts {
34- if attempt > 0
35- && let Some ( retry) = job. retry . as_ref ( ) {
34+ if attempt > 0 {
35+ if let Some ( retry) = job. retry . as_ref ( ) {
3636 let delay = calculate_backoff ( retry, attempt - 1 ) ;
3737 info ! (
3838 target: "rollcron::job" ,
@@ -44,6 +44,7 @@ pub async fn execute_job(job: &Job, sot_path: &Path, runner: &RunnerConfig) -> b
4444 ) ;
4545 sleep ( delay) . await ;
4646 }
47+ }
4748
4849 info ! (
4950 target: "rollcron::job" ,
@@ -400,23 +401,25 @@ fn generate_jitter(max: Duration) -> Duration {
400401// === Logging ===
401402
402403fn rotate_log_file ( path : & Path , max_size : u64 ) {
403- if let Ok ( meta) = fs:: metadata ( path)
404- && meta. len ( ) >= max_size {
404+ if let Ok ( meta) = fs:: metadata ( path) {
405+ if meta. len ( ) >= max_size {
405406 let old_path = path. with_extension ( "log.old" ) ;
406407 let _ = fs:: remove_file ( & old_path) ;
407408 let _ = fs:: rename ( path, & old_path) ;
408409 }
410+ }
409411}
410412
411413fn create_log_file ( job_dir : & Path , log_path : & str , max_size : u64 ) -> Option < File > {
412414 let expanded = env:: expand_string ( log_path) ;
413415 let full_path = job_dir. join ( & expanded) ;
414416
415- if let Some ( parent) = full_path. parent ( )
416- && let Err ( e) = fs:: create_dir_all ( parent) {
417+ if let Some ( parent) = full_path. parent ( ) {
418+ if let Err ( e) = fs:: create_dir_all ( parent) {
417419 warn ! ( target: "rollcron::job" , error = %e, "Failed to create log directory" ) ;
418420 return None ;
419421 }
422+ }
420423
421424 rotate_log_file ( & full_path, max_size) ;
422425
0 commit comments