stacks-core icon indicating copy to clipboard operation
stacks-core copied to clipboard

Enable (and pass) panic-checking lints in stackslib

Open kantai opened this issue 6 months ago • 1 comments

We should be using clippy lints in stackslib -- many lints are purely stylistic, but we should start by prioritizing lints which avoid panics: while the stackslib crate guards panics and unwraps with checks, clippy lints highlight places in the codebase where the rust type system itself could ensure that the checks are performed correctly.

The lints that I think are worth starting with:

  1. clippy::indexing_slicing
  2. clippy::expect_used
  3. clippy::unwrap_used

These won't be small! I think its also worth remembering that sometimes these patterns should be allowed either for performance, or because in some cases, panics really are more appropriate than attempting to soldier on. However, in these cases, we should force the code to explicitly "allow" the usage.

kantai avatar May 27 '25 15:05 kantai

@kantai, cast_possible_truncation also worth including.

moodmosaic avatar May 27 '25 19:05 moodmosaic