9400: fix: Fix renaming associated trait items with colliding names r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot] 2021-06-25 01:48:50 +00:00 committed by GitHub
commit 2ac1ffc0f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View file

@ -544,7 +544,9 @@ impl<'a> FindUsages<'a> {
let trait_ = mod_def
.as_assoc_item(self.sema.db)?
.containing_trait_or_trait_impl(self.sema.db)?;
(trait_ == this_trait).then(|| {
(trait_ == this_trait
&& self.def.name(self.sema.db) == mod_def.name(self.sema.db))
.then(|| {
let FileRange { file_id, range } = self.sema.original_range(name.syntax());
let reference = FileReference {
range,