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_used and expect_used clippy lints are great to warn about common panic points (the first one also warning upon panic! and assert!).
The no_panic crate looks also helpful, but is limited to actual programs and requires some level of optimization to be really useful.
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:
missing_panics_doc
,unwrap_used
andexpect_used
clippy lints are great to warn about common panic points (the first one also warning uponpanic!
andassert!
).