[rs] Get rid of anyhow
This commit is contained in:
parent
6dc0aef430
commit
f0669d159f
6 changed files with 8 additions and 24 deletions
|
|
@ -1,4 +1,4 @@
|
|||
pub fn solve(input: String) -> anyhow::Result<()> {
|
||||
pub fn solve(input: String) {
|
||||
let mut elves = input
|
||||
.trim()
|
||||
.split("\n\n")
|
||||
|
|
@ -18,6 +18,4 @@ pub fn solve(input: String) -> anyhow::Result<()> {
|
|||
// Part 2
|
||||
let top_three = elves.iter().rev().take(3).sum::<u32>();
|
||||
println!("Part 2: {top_three}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ fn read_round(line: &str) -> (Choice, Choice, Outcome) {
|
|||
(l, rc, ro)
|
||||
}
|
||||
|
||||
pub fn solve(input: String) -> anyhow::Result<()> {
|
||||
pub fn solve(input: String) {
|
||||
let matches = input
|
||||
.lines()
|
||||
.map(|l| read_round(l.trim()))
|
||||
|
|
@ -89,6 +89,4 @@ pub fn solve(input: String) -> anyhow::Result<()> {
|
|||
.map(|(l, _, r)| r.against(*l).score() + r.score())
|
||||
.sum::<u32>();
|
||||
println!("Part 2: {score}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ fn highest_score(i: u64) -> u32 {
|
|||
64 - i.leading_zeros()
|
||||
}
|
||||
|
||||
pub fn solve(input: String) -> anyhow::Result<()> {
|
||||
pub fn solve(input: String) {
|
||||
let backpacks = input.lines().map(|l| l.trim()).collect::<Vec<_>>();
|
||||
|
||||
// Part 1
|
||||
|
|
@ -40,6 +40,4 @@ pub fn solve(input: String) -> anyhow::Result<()> {
|
|||
.map(highest_score)
|
||||
.sum::<u32>();
|
||||
println!("Part 2: {score}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue