docs: add common pitfalls section

This commit is contained in:
Felix Spöttel 2022-10-29 14:32:33 +02:00
parent b82974cd4f
commit 1d991f7aab
2 changed files with 6 additions and 2 deletions

View File

@ -48,7 +48,7 @@ Individual solutions live in the `./src/bin/` directory as separate binaries.
Every [solution](https://github.com/fspoettel/advent-of-code-rust/blob/master/src/bin/scaffold.rs#L7-L35) has _unit tests_ referencing its _example_ file. Use these unit tests to develop and debug your solution against example inputs. For some puzzles, it might be easier to forgo the example file and hardcode inputs into the tests.
When editing a solution, `rust-analyzer` will display buttons for these actions above the unit tests.
When editing a solution, `rust-analyzer` will display buttons for running / debugging unit tests above the unit test blocks.
### Download input for a day
@ -182,3 +182,7 @@ Go to the _Secrets_ tab in your repository settings and create the following sec
- [regex](https://crates.io/crates/regex): Official regular expressions implementation for Rust.
Do you have aoc-specific crate recommendations? [Share them!](https://github.com/fspoettel/advent-of-code-rust/edit/master/README.md)
## Common pitfalls
* **Integer overflows:** This template uses 32-bit integers by default because it is generally faster - for example when packed in large arrays or structs - than using 64-bit integers everywhere. For some problems, solutions for real input might exceed 32-bit integer space. While this is checked and panics in `debug` mode, integers [wrap](https://doc.rust-lang.org/book/ch03-02-data-types.html#integer-overflow) in `release` mode, leading to wrong output when running your solution.

View File

@ -5,7 +5,7 @@ use std::{fs, process};
struct Args {
day: u8,
year: Option<u32>,
year: Option<i16>,
}
fn parse_args() -> Result<Args, pico_args::Error> {