From 3ab1519cb27b927074ed7fbbb18a856e6e7fabb8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 23:14:13 +0300 Subject: Change ids strategy this is a part of larghish hir refactoring which aims to * replace per-source-root module trees with per crate trees * switch from a monotyped DedId to type-specific ids --- crates/ra_ide_api/src/rename.rs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'crates/ra_ide_api/src/rename.rs') diff --git a/crates/ra_ide_api/src/rename.rs b/crates/ra_ide_api/src/rename.rs index 53dc273c6..5b767addd 100644 --- a/crates/ra_ide_api/src/rename.rs +++ b/crates/ra_ide_api/src/rename.rs @@ -57,7 +57,6 @@ fn rename_mod( ) -> Option { let mut source_file_edits = Vec::new(); let mut file_system_edits = Vec::new(); - if let Some(module) = module_from_declaration(db, position.file_id, &ast_module) { let (file_id, module_source) = module.definition_source(db); match module_source { @@ -223,11 +222,15 @@ mod tests { fn test_rename_mod() { let (analysis, position) = analysis_and_position( " - //- /bar.rs - mod fo<|>o; - //- /bar/foo.rs - // emtpy - ", + //- /lib.rs + mod bar; + + //- /bar.rs + mod foo<|>; + + //- /bar/foo.rs + // emtpy + ", ); let new_name = "foo2"; let source_change = analysis.rename(position, new_name).unwrap(); @@ -238,11 +241,11 @@ mod tests { fn test_rename_mod_in_dir() { let (analysis, position) = analysis_and_position( " - //- /lib.rs - mod fo<|>o; - //- /foo/mod.rs - // emtpy - ", + //- /lib.rs + mod fo<|>o; + //- /foo/mod.rs + // emtpy + ", ); let new_name = "foo2"; let source_change = analysis.rename(position, new_name).unwrap(); -- cgit v1.2.3