aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/imp.rs5
-rw-r--r--crates/ra_ide_api/src/lib.rs2
-rw-r--r--crates/ra_ide_api/src/rename.rs4
3 files changed, 2 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs
index b52a3f4d5..fa79908a1 100644
--- a/crates/ra_ide_api/src/imp.rs
+++ b/crates/ra_ide_api/src/imp.rs
@@ -19,7 +19,6 @@ use crate::{
19 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit, 19 CrateId, db, Diagnostic, FileId, FilePosition, FileRange, FileSystemEdit,
20 Query, RootChange, SourceChange, SourceFileEdit, 20 Query, RootChange, SourceChange, SourceFileEdit,
21 symbol_index::{FileSymbol, LibrarySymbolsQuery}, 21 symbol_index::{FileSymbol, LibrarySymbolsQuery},
22 rename::rename
23}; 22};
24 23
25impl db::RootDatabase { 24impl db::RootDatabase {
@@ -232,10 +231,6 @@ impl db::RootDatabase {
232 .collect() 231 .collect()
233 } 232 }
234 233
235 pub(crate) fn rename(&self, position: FilePosition, new_name: &str) -> Option<SourceChange> {
236 rename(self, position, new_name)
237 }
238
239 pub(crate) fn index_resolve(&self, name_ref: &ast::NameRef) -> Vec<FileSymbol> { 234 pub(crate) fn index_resolve(&self, name_ref: &ast::NameRef) -> Vec<FileSymbol> {
240 let name = name_ref.text(); 235 let name = name_ref.text();
241 let mut query = Query::new(name.to_string()); 236 let mut query = Query::new(name.to_string());
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 1845bf443..33bef178a 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -466,7 +466,7 @@ impl Analysis {
466 position: FilePosition, 466 position: FilePosition,
467 new_name: &str, 467 new_name: &str,
468 ) -> Cancelable<Option<SourceChange>> { 468 ) -> Cancelable<Option<SourceChange>> {
469 self.with_db(|db| db.rename(position, new_name)) 469 self.with_db(|db| rename::rename(db, position, new_name))
470 } 470 }
471 471
472 fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>( 472 fn with_db<F: FnOnce(&db::RootDatabase) -> T + std::panic::UnwindSafe, T>(
diff --git a/crates/ra_ide_api/src/rename.rs b/crates/ra_ide_api/src/rename.rs
index 9f8a00ae7..9ab6f2a77 100644
--- a/crates/ra_ide_api/src/rename.rs
+++ b/crates/ra_ide_api/src/rename.rs
@@ -40,9 +40,7 @@ fn find_name_and_module_at_offset(
40 position: FilePosition, 40 position: FilePosition,
41) -> Option<(&ast::Name, &ast::Module)> { 41) -> Option<(&ast::Name, &ast::Module)> {
42 let ast_name = find_node_at_offset::<ast::Name>(syntax, position.offset); 42 let ast_name = find_node_at_offset::<ast::Name>(syntax, position.offset);
43 let ast_name_parent = ast_name 43 let ast_name_parent = ast::Module::cast(ast_name?.syntax().parent()?);
44 .and_then(|n| n.syntax().parent())
45 .and_then(|p| ast::Module::cast(p));
46 44
47 if let (Some(ast_module), Some(name)) = (ast_name_parent, ast_name) { 45 if let (Some(ast_module), Some(name)) = (ast_name_parent, ast_name) {
48 return Some((name, ast_module)); 46 return Some((name, ast_module));