From 900b4208fd18800b27035c80581b7e7f3dbba39d Mon Sep 17 00:00:00 2001 From: bitgaoshu Date: Fri, 24 Jun 2022 22:42:30 +0800 Subject: [PATCH] rename "trait_def" to "def_in_trait" --- crates/ide-db/src/rename.rs | 7 +++++-- crates/ide-db/src/search.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/ide-db/src/rename.rs b/crates/ide-db/src/rename.rs index 505ebc98f3a..bade88c5783 100644 --- a/crates/ide-db/src/rename.rs +++ b/crates/ide-db/src/rename.rs @@ -271,7 +271,7 @@ fn rename_reference( } } - let def = convert_to_trait_def(def, sema); + let def = convert_to_def_in_trait(def, sema); let usages = def.usages(sema).all(); if !usages.is_empty() && ident_kind == IdentifierKind::Underscore { @@ -298,7 +298,10 @@ fn rename_reference( Ok(source_change) } -pub(crate) fn convert_to_trait_def(def: Definition, sema: &Semantics) -> Definition { +pub(crate) fn convert_to_def_in_trait( + def: Definition, + sema: &Semantics, +) -> Definition { // HACK: resolve trait impl items to the item def of the trait definition // so that we properly resolve all trait item references let assoc_item = match def { diff --git a/crates/ide-db/src/search.rs b/crates/ide-db/src/search.rs index 25065ba7e32..ce38fe145bd 100644 --- a/crates/ide-db/src/search.rs +++ b/crates/ide-db/src/search.rs @@ -620,7 +620,7 @@ fn found_name_ref( sink(file_id, reference) } Some(NameRefClass::Definition(def)) - if crate::rename::convert_to_trait_def(def, self.sema) == self.def => + if crate::rename::convert_to_def_in_trait(def, self.sema) == self.def => { let FileRange { file_id, range } = self.sema.original_range(name_ref.syntax()); let reference = FileReference {