96eab0655f
[`missing_asserts_for_indexing`]: work with bodies instead of blocks separately Fixes #11856 Before this change, this lint would check blocks independently of each other, which means that it misses `assert!()`s from parent blocks. ```rs // check_block assert!(x.len() > 1); { // check_block // no assert here let _ = x[0] + x[1]; } ``` This PR changes it to work with bodies rather than individual blocks. That means that a function will be checked in one go and we can remember if an `assert!` occurred anywhere. Eventually it would be nice to have a more control flow-aware analysis, possibly by rewriting it as a MIR lint, but that's more complicated and I wanted this fixed first. changelog: [`missing_asserts_for_indexing`]: accept `assert!`s from parent blocks |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |