Skip to content

Commit

Permalink
Tidy up some formatting a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppearson committed Aug 20, 2021
1 parent c5dfedb commit c90b85c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn main() {

if args.len() < 2 {
println!("Error: timecalc requires a command line argument consisting of at least one pair of time strings, i.e. '08:25-14:50'");
return
return;
}

let time_arg = &args[1];
Expand Down
13 changes: 6 additions & 7 deletions rs/src/timeCalc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ struct TimeCalc;
#[derive(Debug)]
#[derive(Default)]
struct TimePoint {

hours: u32,
minutes: u32,
seconds: u32
Expand All @@ -38,11 +37,11 @@ impl TimePoint {
let mut final_val = self.hours * 60 * 60;
final_val += self.minutes * 60;
final_val += self.seconds;
return final_val
return final_val;
}

fn is_null(&self) -> bool {
return self.hours == 0 && self.minutes == 0 && self.seconds == 0
return self.hours == 0 && self.minutes == 0 && self.seconds == 0;
}
}

Expand Down Expand Up @@ -90,7 +89,7 @@ impl TimePeriod {
}

fn is_null(&self) -> bool {
return self.hours == 0 && self.minutes == 0 && self.seconds == 0
return self.hours == 0 && self.minutes == 0 && self.seconds == 0;
}
}

Expand All @@ -107,7 +106,7 @@ impl TimeCalc {

if pair_time_period.is_null() {
println!("Error calculating time period from supplied input value.");
return
return;
}

total_time_period.accumulate(&pair_time_period);
Expand Down Expand Up @@ -178,7 +177,7 @@ impl TimeCalc {
}

let tp = TimePoint{hours: hours, minutes: minutes, seconds: seconds};
return tp
return tp;
}

fn calculate_time_period_from_tp_pair(tp_pair: &String) -> TimePeriod {
Expand All @@ -201,6 +200,6 @@ impl TimeCalc {
tp.add_time_point_delta_in_seconds(tp_delta_seconds);
}

return tp
return tp;
}
}

0 comments on commit c90b85c

Please sign in to comment.