mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
f4fec4ff65
fix: better handling of SelfParam in assist 'inline_call' fix #15470. The current `inline_call` directly translates `&self` into `let ref this = ...;` and `&mut self` into `let ref mut this = ...;`. However, it does not handle some complex scenarios. This PR addresses the following transformations (assuming the receiving object is `obj`): - `self`: `let this = obj` - `mut self`: `let mut this = obj` - `&self`: `let this = &obj` - `&mut self` + If `obj` is `let mut obj = ...`, use a mutable reference: `let this = &mut obj` + If `obj` is `let obj = &mut ...;`, perform a reborrow: `let this = &mut *obj` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |