rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.31k stars 1.62k forks source link

minor: Migrate `(un)wrap_return_type` assists to use `SyntaxEditor` #18524

Open Giga-Bowser opened 4 days ago

Giga-Bowser commented 4 days ago

Part of #15710 and #18285

This PR also includes some small fixes to SyntaxEditor, in particular a fix to the problem with affected_range outlined here.

I also updated unwrap_return_type to use placeholders when unwrapping None. I had tried to do this with the mutable tree API before and it was kind of a pain so it's nice to see improvements like this :)

DropDemBits commented 4 days ago

Forgot to mention that the final tabstop snippet for unwrap_return_type should be after the last placeholder node instead of the last placeholder being considered the end of the snippet mode.