clippies
This commit is contained in:
1 parent
aed73754c8
commit
a7c32b213f
5 files changed
+18
-20
No files matched your search
+4
-4
@@ -93,7 +93,7 @@ pub struct Move {
|
||||
impl FromStr for Move {
|
||||
type Err = Box<dyn std::error::Error>;
|
||||
fn from_str(value: &str) -> Result<Self, Self::Err> {
|
||||
let (theirs, ours) = value.split_once(&" ").ok_or("Unable to split")?;
|
||||
let (theirs, ours) = value.split_once(" ").ok_or("Unable to split")?;
|
||||
Ok(Move {
|
||||
ours: ours.parse()?,
|
||||
theirs: theirs.parse()?,
|
||||
@@ -115,7 +115,7 @@ pub struct MoveGoal {
|
||||
impl FromStr for MoveGoal {
|
||||
type Err = Box<dyn std::error::Error>;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let (theirs, goal) = s.split_once(&" ").ok_or("Unable to split")?;
|
||||
let (theirs, goal) = s.split_once(" ").ok_or("Unable to split")?;
|
||||
Ok(MoveGoal {
|
||||
theirs: theirs.parse()?,
|
||||
goal: goal.parse()?,
|
||||
@@ -142,12 +142,12 @@ fn parse_part2(input: &[u8]) -> Vec<MoveGoal> {
|
||||
}
|
||||
|
||||
#[aoc(day2, part1)]
|
||||
fn part1(input: &Vec<Move>) -> u64 {
|
||||
fn part1(input: &[Move]) -> u64 {
|
||||
input.iter().map(|m| m.score()).sum()
|
||||
}
|
||||
|
||||
#[aoc(day2, part2)]
|
||||
fn part2(input: &Vec<MoveGoal>) -> u64 {
|
||||
fn part2(input: &[MoveGoal]) -> u64 {
|
||||
input.iter().map(|mg| mg.get_move().score()).sum()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user