applied clippy
This commit is contained in:
parent
33eb92e9d1
commit
4e08117ed0
16 changed files with 205 additions and 504 deletions
|
|
@ -14,11 +14,11 @@ impl DayTrait for Day {
|
|||
fn part1(&self, lines: &[String]) -> anyhow::Result<ResultType> {
|
||||
let sum = lines
|
||||
.iter()
|
||||
.map(|line| find_double(&line))
|
||||
.map(|line| find_double(line))
|
||||
.map_ok(priority)
|
||||
.flatten_ok()
|
||||
.fold_ok(0, |a, b| a + b)?;
|
||||
Ok(ResultType::IntResult(sum))
|
||||
Ok(ResultType::Integer(sum))
|
||||
}
|
||||
|
||||
fn part2(&self, lines: &[String]) -> anyhow::Result<ResultType> {
|
||||
|
|
@ -30,7 +30,7 @@ impl DayTrait for Day {
|
|||
.map_ok(priority)
|
||||
.flatten_ok()
|
||||
.fold_ok(0, |a, b| a + b)?;
|
||||
Ok(ResultType::IntResult(sum))
|
||||
Ok(ResultType::Integer(sum))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ fn find_double(content: &str) -> Result<char, RucksackError> {
|
|||
Err(RucksackError::NoDoubleFound)?
|
||||
}
|
||||
|
||||
fn find_badge<'a>(elves: &[&String]) -> Result<char, RucksackError> {
|
||||
fn find_badge(elves: &[&String]) -> Result<char, RucksackError> {
|
||||
if elves.len() < 2 {
|
||||
return Err(RucksackError::NeedAtLeastTwo);
|
||||
};
|
||||
|
|
@ -109,7 +109,7 @@ mod test {
|
|||
fn test_part1() -> Result<()> {
|
||||
let day = Day {};
|
||||
let lines = read_lines(day.get_day_number(), "example01.txt")?;
|
||||
let expected = ResultType::IntResult(157);
|
||||
let expected = ResultType::Integer(157);
|
||||
let result = day.part1(&lines)?;
|
||||
assert_eq!(result, expected);
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ mod test {
|
|||
fn test_part2() -> Result<()> {
|
||||
let day = Day {};
|
||||
let lines = read_lines(day.get_day_number(), "example01.txt")?;
|
||||
let expected = ResultType::IntResult(70);
|
||||
let expected = ResultType::Integer(70);
|
||||
let result = day.part2(&lines)?;
|
||||
assert_eq!(result, expected);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue