aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/rename.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/rename.rs')
-rw-r--r--crates/ra_ide_api/src/rename.rs25
1 files changed, 14 insertions, 11 deletions
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(
57) -> Option<SourceChange> { 57) -> Option<SourceChange> {
58 let mut source_file_edits = Vec::new(); 58 let mut source_file_edits = Vec::new();
59 let mut file_system_edits = Vec::new(); 59 let mut file_system_edits = Vec::new();
60
61 if let Some(module) = module_from_declaration(db, position.file_id, &ast_module) { 60 if let Some(module) = module_from_declaration(db, position.file_id, &ast_module) {
62 let (file_id, module_source) = module.definition_source(db); 61 let (file_id, module_source) = module.definition_source(db);
63 match module_source { 62 match module_source {
@@ -223,11 +222,15 @@ mod tests {
223 fn test_rename_mod() { 222 fn test_rename_mod() {
224 let (analysis, position) = analysis_and_position( 223 let (analysis, position) = analysis_and_position(
225 " 224 "
226 //- /bar.rs 225 //- /lib.rs
227 mod fo<|>o; 226 mod bar;
228 //- /bar/foo.rs 227
229 // emtpy 228 //- /bar.rs
230 ", 229 mod foo<|>;
230
231 //- /bar/foo.rs
232 // emtpy
233 ",
231 ); 234 );
232 let new_name = "foo2"; 235 let new_name = "foo2";
233 let source_change = analysis.rename(position, new_name).unwrap(); 236 let source_change = analysis.rename(position, new_name).unwrap();
@@ -238,11 +241,11 @@ mod tests {
238 fn test_rename_mod_in_dir() { 241 fn test_rename_mod_in_dir() {
239 let (analysis, position) = analysis_and_position( 242 let (analysis, position) = analysis_and_position(
240 " 243 "
241 //- /lib.rs 244 //- /lib.rs
242 mod fo<|>o; 245 mod fo<|>o;
243 //- /foo/mod.rs 246 //- /foo/mod.rs
244 // emtpy 247 // emtpy
245 ", 248 ",
246 ); 249 );
247 let new_name = "foo2"; 250 let new_name = "foo2";
248 let source_change = analysis.rename(position, new_name).unwrap(); 251 let source_change = analysis.rename(position, new_name).unwrap();