2025: clippies
This commit is contained in:
3 files changed
+20
-17
No files matched your search
+5
-6
@@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
collections::{BinaryHeap, VecDeque},
|
||||
hash::Hash,
|
||||
iter::{repeat, repeat_n},
|
||||
};
|
||||
|
||||
@@ -73,8 +72,8 @@ impl From<&str> for MachineDefinition {
|
||||
|
||||
MachineDefinition {
|
||||
desired: parts["desired"].chars().map(|c| c == '#').collect(),
|
||||
buttons: buttons,
|
||||
buttons2: buttons2,
|
||||
buttons,
|
||||
buttons2,
|
||||
buttons_max: i16x16::new(buttons_max),
|
||||
joltages: i16x16::new(joltages),
|
||||
}
|
||||
@@ -127,7 +126,7 @@ impl<'a> JoltMachine<'a> {
|
||||
// // new_joltage[*jolt] += 1;
|
||||
// // }
|
||||
let new_joltage = self.joltages + self.d.buttons2[button];
|
||||
let mut new_presses = presses.clone();
|
||||
let mut new_presses = *presses;
|
||||
new_presses.as_mut_array()[button] += 1;
|
||||
if new_joltage == self.d.joltages {
|
||||
(new_presses, None)
|
||||
@@ -147,7 +146,7 @@ impl<'a> JoltMachine<'a> {
|
||||
.buttons
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, _but)| self.press_jolts(i, &presses))
|
||||
.map(|(i, _but)| self.press_jolts(i, presses))
|
||||
// .inspect(|(p, o)| println!(" {p:?} {o:?}\n"))
|
||||
// joltages monotonically increase, so cull any where a joltage is higher than needed
|
||||
.filter(|(presses, candidate)| {
|
||||
@@ -246,7 +245,7 @@ fn find_best_jolts(md: &MachineDefinition) -> usize {
|
||||
machine: m,
|
||||
});
|
||||
|
||||
let mut pb = ProgressBar::no_length()
|
||||
let pb = ProgressBar::no_length()
|
||||
.with_style(
|
||||
ProgressStyle::with_template(
|
||||
"[{elapsed_precise}/{eta_precise}] {bar:40.cyan/blue} {pos:>7}/{len:7} {per_sec}",
|
||||
|
||||
Reference in new issue
Block a user