Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
connorslade committed Nov 27, 2023
1 parent 4630d2c commit 759ad6e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions aoc_2021/src/day_03.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ impl Solution for Day03 {
// Filter Oxygen
let imax = get_imax(&oxygen_raw, i);
oxygen_raw = gen_raw(oxygen_raw, num_len, &oxygen_keep);
oxygen_keep.retain(|x| x.chars().into_iter().nth(i).unwrap() == imax);
oxygen_keep.retain(|x| x.chars().nth(i).unwrap() == imax);

// Filter Co2
let imax = get_imax(&co2_raw, i);
co2_raw = gen_raw(co2_raw, num_len, &co2_keep);
co2_keep.retain(|x| x.chars().into_iter().nth(i).unwrap() != imax);
co2_keep.retain(|x| x.chars().nth(i).unwrap() != imax);

if oxygen_keep.len() == 1 {
oxygen_gen = isize::from_str_radix(oxygen_keep.first().unwrap(), 2).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions aoc_2021/src/day_10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ impl Solution for Day10 {

if !is_corrupted {
let mut score = 0;
while !queue.is_empty() {
let ch = queue.pop().unwrap();
while let Some(ch) = queue.pop() {
score = 5 * score
+ match ch {
')' => 1,
Expand Down
4 changes: 2 additions & 2 deletions aoc_2022/src/day_05.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ impl Solution for Day05 {
}

fn part_a(&self, input: &str) -> Answer {
process(&input, true).into()
process(input, true).into()
}

fn part_b(&self, input: &str) -> Answer {
process(&input, false).into()
process(input, false).into()
}
}

Expand Down
2 changes: 1 addition & 1 deletion aoc_2022/src/day_18.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const NEIGHBORS: [Point3; 6] = [
impl World {
fn parse(raw: &str) -> Self {
Self {
points: HashSet::from_iter(parse(raw).into_iter()),
points: HashSet::from_iter(parse(raw)),
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pub fn load(year: u32, day: u32) -> io::Result<String> {
/// Load the input for the given year and day.
pub fn load_raw(year: u32, day: u32) -> io::Result<String> {
let file = format!("data/{year}/{:02}.txt", day);
fs::read_to_string(&file)
fs::read_to_string(file)
}
4 changes: 2 additions & 2 deletions scaffold/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct Formatter {
}

#[derive(Debug)]
enum Component {
pub enum Component {
Literal(String),
Format {
name: String,
Expand All @@ -19,7 +19,7 @@ enum Component {
}

#[derive(Debug)]
enum Processor {
pub enum Processor {
Pad { width: usize },
Uppercase,
}
Expand Down
9 changes: 5 additions & 4 deletions scaffold/todo.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Todo

- [ ] Formatter
- [ ] Commands
- [ ] Init
- [x] Formatter
- [x] Commands
- [x] Init
- [x] Scaffold
- [ ] Module
- [x] Module
- [x] Input
- [x] Verify
- [x] Token
- [x] Timer
- [ ] Allow not filling the solution array
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn get_year(year: u32) -> &'static [&'static dyn Solution] {
match year {
2021 => &aoc_2021::ALL,
2022 => &aoc_2022::ALL,
2023 => &aoc_2023::ALL,
2023 => aoc_2023::ALL,
_ => &[],
}
}
Expand Down

0 comments on commit 759ad6e

Please sign in to comment.