]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #9386 - smoelius:further-enhance-needless-borrow, r=Jarcho
authorbors <bors@rust-lang.org>
Sat, 8 Oct 2022 21:24:54 +0000 (21:24 +0000)
committerbors <bors@rust-lang.org>
Sat, 8 Oct 2022 21:24:54 +0000 (21:24 +0000)
Further enhance `needless_borrow`, mildly refactor `redundant_clone`

This PR does the following:
* Moves some code from `redundant_clone` into a new `clippy_utils` module called `mir`, and wraps that code in a function called `dropped_without_further_use`.
* Relaxes the "is copyable" condition condition from #9136 by also suggesting to remove borrows from values dropped without further use. The changes involve the just mentioned function.
* Separates `redundant_clone` into modules.

Strictly speaking, the last bullet is independent of the others. `redundant_clone` is somewhat hairy, IMO. Separating it into modules makes it slightly less so, by helping to delineate what depends upon what.

I've tried to break everything up into digestible commits.

r? `@Jarcho`

(`@Jarcho` I hope you don't mind.)

changelog: continuation of #9136

1  2 
clippy_utils/src/lib.rs

Simple merge