rustfmt 2023

This commit is contained in:
Dylan Thies
2023-12-29 08:57:56 -05:00
parent c05ab694ab
commit 49009dfada
11 changed files with 133 additions and 79 deletions

View File

@@ -23,7 +23,10 @@ pub fn part1(input: &str) -> nom::IResult<&str, String> {
"",
values
.iter()
.map(|v| v.first().expect("always at least one number") * 10 + v.last().expect("always atleast one number"))
.map(|v| {
v.first().expect("always at least one number") * 10
+ v.last().expect("always atleast one number")
})
.sum::<u32>()
.to_string(),
))

View File

@@ -12,7 +12,10 @@ pub fn part2(input: &str) -> String {
println!("{values:?}");
values
.iter()
.map(|v| v.first().expect("There is always at least one number") * 10 + v.last().expect("there is always at least one number"))
.map(|v| {
v.first().expect("There is always at least one number") * 10
+ v.last().expect("there is always at least one number")
})
.sum::<u32>()
.to_string()
}
@@ -42,7 +45,11 @@ fn parse_line(line: &str) -> Vec<u32> {
} else if reduced_line.starts_with("zero") {
Some(0)
} else {
reduced_line.chars().next().expect("there is alwayss a character").to_digit(10)
reduced_line
.chars()
.next()
.expect("there is alwayss a character")
.to_digit(10)
};
result