mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
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 |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |