# Andre Bogus - How to Write CRaP Rust Code (Highlights)

## Highlights
- #![warn(missing\_doc\_code\_examples)]
- Extend your testing toolbox with [quickcheck](https://docs.rs/quickcheck) or [proptest](https://altsysrq.github.io/proptest-book/intro.html).
- how to use `[afl](https://github.com/rust-fuzz/afl.rs)` or `[cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz)` to find failing test inputs.
- Learn and work with the tools your system offers. For sampling profilers, the [inferno](https://docs.rs/inferno) docs have very nice directions to get a flamegraph for your code (Kudos to Jon Gjengset). If your application has any sort of concurrency, you may also want to give [coz](https://github.com/plasma-umass/coz) a try.
- [DHAT](https://valgrind.org/docs/manual/dh-manual.html) can provide a solid overview of where memory is used.
- Does your `HashMap` have fewer than 50 entries most of the time? Use a `Vec<(key, value)>` instead, especially if you can `sort\_by\_key` and `binary\_search\_by\_key` it for lookup. If your `Vec`s have mostly one or two elements, perhaps try a `[SmallVec](https://docs.rs/smallvec)` (or `[tinyvec](https://docs.rs/tinyvec)` if it gives you the same perf).