Fix clippy errors

This commit is contained in:
2025-05-26 15:50:22 -05:00
parent da92f241eb
commit a400730c88
3 changed files with 45 additions and 63 deletions

View File

@@ -65,11 +65,11 @@ fn compare_levels(curr_level: i64, next_level: i64) -> LevelTransition {
TransitionDirection::Desc
};
return LevelTransition { state, direction };
LevelTransition { state, direction }
}
/// Tests if a report is safe
fn is_report_safe_no_dampening(report: &Vec<i64>) -> bool {
fn is_report_safe_no_dampening(report: &[i64]) -> bool {
// Turn the report into a bunch of states for each adjacent pair in the report
let report: Vec<LevelTransition> = report
.windows(2)
@@ -98,13 +98,14 @@ fn is_report_safe_no_dampening(report: &Vec<i64>) -> bool {
// Setup for next iteration
prev_transition = level_transition;
}
return true;
true
}
/// Tests if a report is safe or code be made safe if you remove a single
/// level from the report
fn is_report_safe_with_dampening_brute_force(report: &Vec<i64>) -> bool {
if is_report_safe_no_dampening(&report) {
fn is_report_safe_with_dampening_brute_force(report: &[i64]) -> bool {
if is_report_safe_no_dampening(report) {
return true;
}
@@ -115,7 +116,8 @@ fn is_report_safe_with_dampening_brute_force(report: &Vec<i64>) -> bool {
return true;
}
}
return false;
false
}
// fn compare_levels_3(prev_level: i64, curr_level: i64, next_level: i64) -> LevelTransition {