fspoettel / advent-of-code-rust

🎄Starter template for solving Advent of Code in Rust.
MIT License
713 stars 54 forks source link

Have parts use Result instead of Option #71

Open ahenshaw opened 17 hours ago

ahenshaw commented 17 hours ago

Would it be better to return a Result instead of an Option for the parts? Given the nature of the puzzles, we should be generating either a value or an error. Plus, I'd like to replace all of my unwraps with "?"s.

fspoettel commented 17 hours ago

I'd like to replace all of my unwraps with "?"s

You can append .ok() to results to cast them to an option, then your ? will work.