mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
feat: add trait_impl_reduntant_assoc_item diagnostic
This commit is contained in:
parent
77e362c34d
commit
5d84edd430
4 changed files with 85 additions and 0 deletions
|
@ -693,6 +693,25 @@ impl Module {
|
|||
},
|
||||
));
|
||||
|
||||
let reduntant: Vec<_> = impl_assoc_items_scratch.iter()
|
||||
.filter(|(id, name)| {
|
||||
!required_items.clone().any(|(impl_name, impl_item)| {
|
||||
discriminant(impl_item) == discriminant(id) && impl_name == name
|
||||
})
|
||||
})
|
||||
.map(|(item, name)| (name.clone(), AssocItem::from(*item)))
|
||||
.collect();
|
||||
if !reduntant.is_empty() {
|
||||
acc.push(
|
||||
TraitImplReduntantAssocItems {
|
||||
impl_: ast_id_map.get(node.ast_id()),
|
||||
file_id,
|
||||
reduntant,
|
||||
}
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
|
||||
let missing: Vec<_> = required_items
|
||||
.filter(|(name, id)| {
|
||||
!impl_assoc_items_scratch.iter().any(|(impl_item, impl_name)| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue