advent-of-code

advent of code (partial solutions)
Log | Files | Refs | README

commit 46796e60bae392767f19cf16fb534bf6be8a3b95
parent 44bcd4c3447509a94a6ba2b8272220d956bbab3d
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Tue, 30 Nov 2021 10:55:38 -0800

improve error handling

Diffstat:
M2021/_tmpl.rs | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/2021/_tmpl.rs b/2021/_tmpl.rs @@ -1,12 +1,14 @@ +use std::error::Error; use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; -fn main() { +fn main() -> Result<(), Box<dyn Error>> { let stdin = io::stdin(); for line in stdin.lock().lines() { - println!("{}", line.unwrap()); + println!("{}", line?); } println!("part 1:"); println!("part 2:"); + Ok(()) }