diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-12-04 16:10:18 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-12-04 16:10:18 -0500 |
commit | 7543903709a1c7e56be6260befb117baea833c0a (patch) | |
tree | f27178335b2e7cebc33f7d7c3da383e55e02f233 /src/2020/4/mod.rs | |
parent | 29b1679b024f4f56d43b1646d6fa5d301994f6f4 (diff) | |
download | advent-of-code-7543903709a1c7e56be6260befb117baea833c0a.tar.gz advent-of-code-7543903709a1c7e56be6260befb117baea833c0a.zip |
refactor
Diffstat (limited to 'src/2020/4/mod.rs')
-rw-r--r-- | src/2020/4/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/2020/4/mod.rs b/src/2020/4/mod.rs index 4b51b29..076a524 100644 --- a/src/2020/4/mod.rs +++ b/src/2020/4/mod.rs @@ -3,7 +3,7 @@ use anyhow::Context as _; const REQUIRED_KEYS: &[&str] = &["byr", "iyr", "eyr", "hgt", "hcl", "ecl", "pid"]; -pub fn part1() -> anyhow::Result<()> { +pub fn part1() -> anyhow::Result<i64> { let batch = crate::util::read_file_str("data/4.txt")?; let mut valid = 0; for passport in parse(&batch)? { @@ -18,11 +18,10 @@ pub fn part1() -> anyhow::Result<()> { valid += 1; } } - println!("{}", valid); - Ok(()) + Ok(valid) } -pub fn part2() -> anyhow::Result<()> { +pub fn part2() -> anyhow::Result<i64> { let batch = crate::util::read_file_str("data/4.txt")?; let mut valid = 0; for passport in parse(&batch)? { @@ -45,8 +44,7 @@ pub fn part2() -> anyhow::Result<()> { valid += 1; } } - println!("{}", valid); - Ok(()) + Ok(valid) } fn parse( |