Skip to content

Commit

Permalink
clippymanual
Browse files Browse the repository at this point in the history
  • Loading branch information
vintitres committed Sep 14, 2023
1 parent 4146b28 commit fcca459
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/day22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ fn parse_moves(input: &str) -> Vec<Move> {
fn walk(
input: &str,
step_fn: for<'a> fn(
&'a Vec<Vec<char>>,
&'a [Vec<char>],
(usize, usize),
Facing,
&Vec<Wall>,
&[Wall],
) -> Option<((usize, usize), Facing)>,
walls: &Vec<Wall>,
walls: &[Wall],
) -> u64 {
let input = input.lines().collect_vec();
let (map, moves) = input.split_at(input.len() - 2);
Expand Down Expand Up @@ -120,10 +120,10 @@ pub fn part1(input: &str) -> u64 {
}

fn step_fn1(
map: &Vec<Vec<char>>,
map: &[Vec<char>],
pos: (usize, usize),
face: Facing,
_walls: &Vec<Wall>,
_walls: &[Wall],
) -> Option<((usize, usize), Facing)> {
let mut pos = pos;
loop {
Expand Down Expand Up @@ -163,7 +163,7 @@ struct WallConnectionInfo {
invert_shift: bool,
}
impl WallConnectionInfo {
fn new_pos_when_entering(&self, shift: usize, walls: &Vec<Wall>) -> (GlobalPos, Facing) {
fn new_pos_when_entering(&self, shift: usize, walls: &[Wall]) -> (GlobalPos, Facing) {
walls[self.wall_index].new_pos_when_entering(self.new_facing, shift, self.invert_shift)
}
}
Expand Down Expand Up @@ -200,7 +200,7 @@ impl Wall {
)
}

fn try_step(&self, pos: GlobalPos, face: Facing, walls: &Vec<Wall>) -> (GlobalPos, Facing) {
fn try_step(&self, pos: GlobalPos, face: Facing, walls: &[Wall]) -> (GlobalPos, Facing) {
let local_pos = self.local_pos(pos);
match face {
Facing::Up => {
Expand Down Expand Up @@ -242,10 +242,10 @@ impl Wall {
}

fn step_fn_cube(
map: &Vec<Vec<char>>,
map: &[Vec<char>],
pos: (usize, usize),
face: Facing,
walls: &Vec<Wall>,
walls: &[Wall],
) -> Option<((usize, usize), Facing)> {
// eprintln!("{:?} {:?}", pos, face);
let wall = walls.iter().find(|w| w.has_global_pos(pos)).unwrap();
Expand Down

0 comments on commit fcca459

Please sign in to comment.