Expand description
Rename infrastructure for rust-analyzer. It is used primarily for the literal “rename” in the ide (look for tests there), but it is also available as a general-purpose service. For example, it is used by the fix for the “incorrect case” diagnostic.
It leverages the crate::search
functionality to find what needs to be
renamed. The actual renames are tricky – field shorthands need special
attention, and, when renaming modules, you also want to rename files on the
file system.
Another can of worms are macros:
ⓘ
macro_rules! m { () => { fn f() {} } }
m!();
fn main() {
f() // <- rename me
}
The correct behavior in such cases is probably to show a dialog to the user. Our current behavior is ¯_(ツ)_/¯.