cros-codecs
cros-codecs copied to clipboard
`codec` module should never panic under any condition
Codecs should be hardened to the point where they cannot panic under any circumstance. This means no unwrap, no array indexes that could be out-of-bounds, etc. Any problem with the codec should return a specific error.
The problem is with detecting these panic conditions. There are a few features that could help:
- The
missing_panics_doc,unwrap_usedandexpect_usedclippy lints are great to warn about common panic points (the first one also warning uponpanic!andassert!). - The no_panic crate looks also helpful, but is limited to actual programs and requires some level of optimization to be really useful.