diff options
| author | bors <bors@rust-lang.org> | 2023-06-07 07:14:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-07 07:14:12 +0000 |
| commit | 7c34ec8947f00f316f66ce2ed7068a0395828833 (patch) | |
| tree | 72f4a2333fe10f4d207dd88a17820544a7e46681 /tests/debuginfo/enum-thinlto.rs | |
| parent | f72914732527904480887847fe2c20df42e24dc2 (diff) | |
| parent | e70dd55fd63ca0378ce143efd72c0c3b01914b15 (diff) | |
| download | rust-7c34ec8947f00f316f66ce2ed7068a0395828833.tar.gz rust-7c34ec8947f00f316f66ce2ed7068a0395828833.zip | |
Auto merge of #10896 - y21:eager-or-lazy-autoderef, r=blyxyas,xFrednet
consider autoderef through user-defined `Deref` in `eager_or_lazy`
Fixes #10462
This PR handles autoderef in the `eager_or_lazy` util module and stops suggesting to change lazy to eager if autoderef in an expression goes through user defined `Deref` impls, e.g.
```rs
struct S;
impl Deref for S {
type Target = ();
fn deref(&self) -> &Self::Target { &() }
}
let _ = Some(()).as_ref().unwrap_or_else(|| &S); // autoderef `&S` -> `&()`
```
changelog: [`unnecessary_lazy_evaluations`]: don't suggest changing lazy evaluation to eager if autoderef goes through user-defined `Deref`
r? `@xFrednet` (because of the earlier review in #10864, might help for context here)
Diffstat (limited to 'tests/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions
