mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 13:43:17 +00:00
db1bda3df1
Extend `needless_lifetimes` to suggest eliding `impl` lifetimes Example: ``` error: the following explicit lifetimes could be elided: 'a --> tests/ui/needless_lifetimes.rs:332:10 | LL | impl<'a> Foo for Baz<'a> {} | ^^ ^^ | help: elide the lifetimes | LL - impl<'a> Foo for Baz<'a> {} LL + impl Foo for Baz<'_> {} ``` The main change is in how `impl` lifetime uses are tracked. Previously, a hashmap was created, and lifetimes were removed from the hashmap as their uses were discovered. However, the uses are needed to generate elision suggestions. So, now, uses are added to the hashmap as they are discovered. The PR is currently organized as six commits, which I think are self-explanatory: - Extend `needless_lifetimes` to suggest eliding `impl` lifetimes - Reorder functions _[not strictly necessary, but IMHO, the code is better structured as a result]_ - Fix lifetime tests - Fix non-lifetime tests - Fix `clippy_lints` and `clippy_utils` - Fix typo in `needless_lifetimes` test r? `@Alexendoo` (I think you are `needless_lifetimes`' primary author? Sorry if I have this wrong.) --- changelog: Extend `needless_lifetimes` to suggest eliding `impl` lifetimes |
||
---|---|---|
.. | ||
test_utils | ||
ui | ||
ui-cargo | ||
ui-internal | ||
ui-toml | ||
workspace_test | ||
check-fmt.rs | ||
clippy.toml | ||
compile-test.rs | ||
config-metadata.rs | ||
dogfood.rs | ||
headers.rs | ||
integration.rs | ||
lint_message_convention.rs | ||
missing-test-files.rs | ||
versioncheck.rs | ||
workspace.rs |