aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db/src/rename.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db/src/rename.rs')
-rw-r--r--crates/ide_db/src/rename.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ide_db/src/rename.rs b/crates/ide_db/src/rename.rs
index d77602453..82855725f 100644
--- a/crates/ide_db/src/rename.rs
+++ b/crates/ide_db/src/rename.rs
@@ -80,7 +80,7 @@ impl Definition {
80 /// Textual range of the identifier which will change when renaming this 80 /// Textual range of the identifier which will change when renaming this
81 /// `Definition`. Note that some definitions, like buitin types, can't be 81 /// `Definition`. Note that some definitions, like buitin types, can't be
82 /// renamed. 82 /// renamed.
83 pub fn rename_range(self, sema: &Semantics<RootDatabase>) -> Option<FileRange> { 83 pub fn range_for_rename(self, sema: &Semantics<RootDatabase>) -> Option<FileRange> {
84 // FIXME: the `original_file_range` calls here are wrong -- they never fail, 84 // FIXME: the `original_file_range` calls here are wrong -- they never fail,
85 // and _fall back_ to the entirety of the macro call. Such fall back is 85 // and _fall back_ to the entirety of the macro call. Such fall back is
86 // incorrect for renames. The safe behavior would be to return an error for 86 // incorrect for renames. The safe behavior would be to return an error for
@@ -412,8 +412,9 @@ fn source_edit_from_def(
412 def: Definition, 412 def: Definition,
413 new_name: &str, 413 new_name: &str,
414) -> Result<(FileId, TextEdit)> { 414) -> Result<(FileId, TextEdit)> {
415 let frange = 415 let frange = def
416 def.rename_range(sema).ok_or_else(|| format_err!("No identifier available to rename"))?; 416 .range_for_rename(sema)
417 .ok_or_else(|| format_err!("No identifier available to rename"))?;
417 418
418 let mut replacement_text = String::new(); 419 let mut replacement_text = String::new();
419 let mut repl_range = frange.range; 420 let mut repl_range = frange.range;