diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-13 08:18:49 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-13 08:18:49 +0100 |
commit | adbee621a75f47e0da4f30d7205dfce009138865 (patch) | |
tree | ed8dcbba37de566f00d119817e141bb8293ce164 /crates/ide/src/references | |
parent | f107b0f1e223dba33cb9850ce44bcbb4345eef52 (diff) | |
parent | 5ac6804bb3a07b959e8c2c3534255a8d6bb4948c (diff) |
Merge #9242
9242: Clippy r=matklad a=Maan2003
Best viewed commit wise
Co-authored-by: Maan2003 <[email protected]>
Diffstat (limited to 'crates/ide/src/references')
-rw-r--r-- | crates/ide/src/references/rename.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 7dfc5043e..50cc1f963 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -64,7 +64,7 @@ pub(crate) fn prepare_rename( | |||
64 | } | 64 | } |
65 | }; | 65 | }; |
66 | let name_like = sema | 66 | let name_like = sema |
67 | .find_node_at_offset_with_descend(&syntax, position.offset) | 67 | .find_node_at_offset_with_descend(syntax, position.offset) |
68 | .ok_or_else(|| format_err!("No references found at position"))?; | 68 | .ok_or_else(|| format_err!("No references found at position"))?; |
69 | let node = match &name_like { | 69 | let node = match &name_like { |
70 | ast::NameLike::Name(it) => it.syntax(), | 70 | ast::NameLike::Name(it) => it.syntax(), |
@@ -104,7 +104,7 @@ pub(crate) fn rename_with_semantics( | |||
104 | 104 | ||
105 | let def = find_definition(sema, syntax, position)?; | 105 | let def = find_definition(sema, syntax, position)?; |
106 | match def { | 106 | match def { |
107 | Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(&sema, module, new_name), | 107 | Definition::ModuleDef(ModuleDef::Module(module)) => rename_mod(sema, module, new_name), |
108 | Definition::SelfType(_) => bail!("Cannot rename `Self`"), | 108 | Definition::SelfType(_) => bail!("Cannot rename `Self`"), |
109 | Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"), | 109 | Definition::ModuleDef(ModuleDef::BuiltinType(_)) => bail!("Cannot rename builtin type"), |
110 | def => rename_reference(sema, def, new_name), | 110 | def => rename_reference(sema, def, new_name), |
@@ -323,7 +323,7 @@ fn rename_reference( | |||
323 | } | 323 | } |
324 | let mut source_change = SourceChange::default(); | 324 | let mut source_change = SourceChange::default(); |
325 | source_change.extend(usages.iter().map(|(&file_id, references)| { | 325 | source_change.extend(usages.iter().map(|(&file_id, references)| { |
326 | (file_id, source_edit_from_references(&references, def, new_name)) | 326 | (file_id, source_edit_from_references(references, def, new_name)) |
327 | })); | 327 | })); |
328 | 328 | ||
329 | let (file_id, edit) = source_edit_from_def(sema, def, new_name)?; | 329 | let (file_id, edit) = source_edit_from_def(sema, def, new_name)?; |
@@ -413,7 +413,7 @@ fn rename_self_to_param( | |||
413 | let mut source_change = SourceChange::default(); | 413 | let mut source_change = SourceChange::default(); |
414 | source_change.insert_source_edit(file_id.original_file(sema.db), edit); | 414 | source_change.insert_source_edit(file_id.original_file(sema.db), edit); |
415 | source_change.extend(usages.iter().map(|(&file_id, references)| { | 415 | source_change.extend(usages.iter().map(|(&file_id, references)| { |
416 | (file_id, source_edit_from_references(&references, def, new_name)) | 416 | (file_id, source_edit_from_references(references, def, new_name)) |
417 | })); | 417 | })); |
418 | Ok(source_change) | 418 | Ok(source_change) |
419 | } | 419 | } |
@@ -426,7 +426,7 @@ fn text_edit_from_self_param(self_param: &ast::SelfParam, new_name: &str) -> Opt | |||
426 | None | 426 | None |
427 | } | 427 | } |
428 | 428 | ||
429 | let impl_def = self_param.syntax().ancestors().find_map(|it| ast::Impl::cast(it))?; | 429 | let impl_def = self_param.syntax().ancestors().find_map(ast::Impl::cast)?; |
430 | let type_name = target_type_name(&impl_def)?; | 430 | let type_name = target_type_name(&impl_def)?; |
431 | 431 | ||
432 | let mut replacement_text = String::from(new_name); | 432 | let mut replacement_text = String::from(new_name); |