Skip to content

Commit

Permalink
clippy and stars
Browse files Browse the repository at this point in the history
  • Loading branch information
BakerNet committed Dec 20, 2023
1 parent 8371d84 commit e9b1d25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
| [Day 17](https://adventofcode.com/2023/day/17) | [code](src/bin/17.rs) |||
| [Day 18](https://adventofcode.com/2023/day/18) | [code](src/bin/18.rs) |||
| [Day 19](https://adventofcode.com/2023/day/19) | [code](src/bin/19.rs) |||
| [Day 20](https://adventofcode.com/2023/day/20) | [code](src/bin/20.rs) | | |
| [Day 20](https://adventofcode.com/2023/day/20) | [code](src/bin/20.rs) | | |
| [Day 21](https://adventofcode.com/2023/day/21) | [code](src/bin/21.rs) | | |
| [Day 22](https://adventofcode.com/2023/day/22) | [code](src/bin/22.rs) | | |
| [Day 23](https://adventofcode.com/2023/day/23) | [code](src/bin/23.rs) | | |
Expand Down
7 changes: 4 additions & 3 deletions src/bin/20.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ enum Module {
impl Module {
fn with_name_from(line: &str) -> (String, Self) {
let parts: Vec<_> = line.split(" -> ").collect();
if line.starts_with("%") {
if line.starts_with('%') {
let name = &parts[0][1..];
let outputs = parts[1].split(", ").map(|s| s.to_owned()).collect();
(name.to_owned(), Self::FlipFlop(false, outputs))
} else if line.starts_with("&") {
} else if line.starts_with('&') {
let name = &parts[0][1..];
let outputs = parts[1].split(", ").map(|s| s.to_owned()).collect();
(name.to_owned(), Self::Conjunction(Vec::new(), outputs))
Expand All @@ -53,7 +53,7 @@ impl Module {
}
}

fn update_state(&mut self, names: Vec<String>) -> () {
fn update_state(&mut self, names: Vec<String>) {
if let Self::Conjunction(ref mut state, _) = self {
*state = names.iter().map(|s| (s.to_owned(), Pulse::Low)).collect();
}
Expand Down Expand Up @@ -166,6 +166,7 @@ fn press_button_part2(
}

fn modules_from_input(input: &str) -> (Vec<String>, HashMap<String, Module>, Option<String>) {
#[allow(clippy::type_complexity)]
let (broadcast, mut modules, inputs): (
Vec<String>,
HashMap<String, Module>,
Expand Down

0 comments on commit e9b1d25

Please sign in to comment.