'Inline into all callers' generates noisy syntax that needs manual cleanups
In non-trivial cases RA transforms inlining of a call:
obj.call(val1, val2)into something like:
{
let this = &obj;
let arg1: Type1 = val1;
let arg2: Type2 = val2;
call body
}To me this syntax is too ugly and noisy. I never want to leave the code like that. Even if I actually needed to make temporary variables, I'd put them as statements at the same level as the call statement, without nesting them inside a block.
It means I always have to manually clean this up. It often defeats the purpose of the inlining feature, because it's about as much work to substitute the temporary variables and delete the block as it is to inline the call in the first place.
I understand that RA does this to be exact about borrowing, temporary scopes and preserving of side effects, but in practice these aren't an issue for me. I strongly prefer a risk of invalid code with a clean syntax than the semantic-preserving awkward syntax. I'm not inlining the code like a semantically-transparent compiler optimizer to run it as-is, I'm inlining it as an editor of readable code, to have leaner and cleaner codebase.
The worst offender is the translation of:
some.obj.outer_call();into
{
let this = &some.obj;
this.nested_call();
}instead of just some.obj.nested_call(). The ref-preserving temporary this is completely redundant, because auto deref handles this transparently.
Source: rust-lang/rust-analyzer