From 94f7b63522cb7464a853c74a8431587db6434b12 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 14 Jun 2021 19:15:53 +0300 Subject: minor: less ambiguous name --- crates/ide/src/rename.rs | 5 +++-- crates/ide_db/src/rename.rs | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs index 41689a939..8096dfa0e 100644 --- a/crates/ide/src/rename.rs +++ b/crates/ide/src/rename.rs @@ -32,8 +32,9 @@ pub(crate) fn prepare_rename( let syntax = source_file.syntax(); let def = find_definition(&sema, syntax, position)?; - let frange = - def.rename_range(&sema).ok_or_else(|| format_err!("No references found at position"))?; + let frange = def + .range_for_rename(&sema) + .ok_or_else(|| format_err!("No references found at position"))?; Ok(RangeInfo::new(frange.range, ())) } 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 { /// Textual range of the identifier which will change when renaming this /// `Definition`. Note that some definitions, like buitin types, can't be /// renamed. - pub fn rename_range(self, sema: &Semantics) -> Option { + pub fn range_for_rename(self, sema: &Semantics) -> Option { // FIXME: the `original_file_range` calls here are wrong -- they never fail, // and _fall back_ to the entirety of the macro call. Such fall back is // incorrect for renames. The safe behavior would be to return an error for @@ -412,8 +412,9 @@ fn source_edit_from_def( def: Definition, new_name: &str, ) -> Result<(FileId, TextEdit)> { - let frange = - def.rename_range(sema).ok_or_else(|| format_err!("No identifier available to rename"))?; + let frange = def + .range_for_rename(sema) + .ok_or_else(|| format_err!("No identifier available to rename"))?; let mut replacement_text = String::new(); let mut repl_range = frange.range; -- cgit v1.2.3