summaryrefslogtreecommitdiffstats
path: root/src/2020/2/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/2020/2/mod.rs')
-rw-r--r--src/2020/2/mod.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/2020/2/mod.rs b/src/2020/2/mod.rs
index a81665b..1026b03 100644
--- a/src/2020/2/mod.rs
+++ b/src/2020/2/mod.rs
@@ -1,4 +1,5 @@
use anyhow::Context as _;
+use std::convert::TryInto as _;
use std::io::BufRead as _;
struct Line {
@@ -51,18 +52,16 @@ impl Line {
}
}
-pub fn part1() -> anyhow::Result<()> {
+pub fn part1() -> anyhow::Result<i64> {
let lines = read_lines()?;
let count = lines.iter().filter(|l| l.valid_part_1()).count();
- println!("{}", count);
- Ok(())
+ Ok(count.try_into()?)
}
-pub fn part2() -> anyhow::Result<()> {
+pub fn part2() -> anyhow::Result<i64> {
let lines = read_lines()?;
let count = lines.iter().filter(|l| l.valid_part_2()).count();
- println!("{}", count);
- Ok(())
+ Ok(count.try_into()?)
}
fn read_lines() -> anyhow::Result<Vec<Line>> {