cleaning up day5 with clippy

This commit is contained in:
Dylan Thies
2023-08-26 06:55:00 -04:00
parent 2b2247b0b4
commit e970fd9873
6 changed files with 198 additions and 10 deletions

View File

@@ -6,15 +6,15 @@ struct Crate {
label: String,
}
#[derive(Clone, Debug)]
#[derive(Debug)]
struct GameBoard {
labels: Vec<String>,
_labels: Vec<String>,
board: Vec<Vec<Crate>>,
}
impl GameBoard {
fn game1_move(&mut self, count: usize, from: usize, to: usize) {
let ref mut v: Vec<Crate> = Vec::new();
fn _game1_move(&mut self, count: usize, from: usize, to: usize) {
let v = &mut Vec::new();
let work = self.board.get_mut(from - 1).unwrap();
for _ in 0..count {
v.push(work.pop().unwrap());
@@ -25,7 +25,7 @@ impl GameBoard {
}
}
fn game2_move(&mut self, count: usize, from: usize, to: usize) {
let ref mut v: Vec<Crate> = Vec::new();
let v = &mut Vec::new();
let work = self.board.get_mut(from - 1).unwrap();
for _ in 0..count {
v.push(work.pop().unwrap());
@@ -67,7 +67,10 @@ impl From<Vec<String>> for GameBoard {
}
})
});
GameBoard { labels, board }
GameBoard {
_labels: labels,
board,
}
}
}