cros-codecs icon indicating copy to clipboard operation
cros-codecs copied to clipboard

`codec` module should never panic under any condition

Open Gnurou opened this issue 1 year ago • 0 comments

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.

Gnurou avatar Jun 23 '24 12:06 Gnurou