b97eaab558
[`unnecessary_unwrap`]: lint on `.as_ref().unwrap()` Closes #11371 This turned out to be a little more code than I originally thought, because the lint also makes sure to not lint if the user tries to mutate the option: ```rs if option.is_some() { option = None; option.unwrap(); // don't lint here } ``` ... which means that even if we taught this lint to recognize `.as_mut()`, it would *still* not lint because that would count as a mutation. So we need to allow `.as_mut()` calls but reject other kinds of mutations. Unfortunately it doesn't look like this is possible with `is_potentially_mutated` (seeing what kind of mutation happened). This replaces it with a custom little visitor that does basically what it did before, but also allows `.as_mut()`. changelog: [`unnecessary_unwrap`]: lint on `.as_ref().unwrap()` |
||
---|---|---|
.. | ||
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 |