mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Compute more mathematically well-rounded notion of transitive deps
By including the crate itself, we make the resulting set closed with respect to `transitve_reveres_dependencies` operation, as it becomes a proper transitive closure. This just feels more proper and mathy. And, indeed, this actually allows us to simplify call sites somewhat.
This commit is contained in:
parent
4b997b8663
commit
45a8f37b6a
3 changed files with 5 additions and 6 deletions
|
@ -1572,8 +1572,7 @@ impl Impl {
|
|||
pub fn all_for_trait(db: &dyn HirDatabase, trait_: Trait) -> Vec<Impl> {
|
||||
let krate = trait_.module(db).krate();
|
||||
let mut all = Vec::new();
|
||||
for Crate { id } in krate.transitive_reverse_dependencies(db).into_iter().chain(Some(krate))
|
||||
{
|
||||
for Crate { id } in krate.transitive_reverse_dependencies(db).into_iter() {
|
||||
let impls = db.trait_impls_in_crate(id);
|
||||
all.extend(impls.for_trait(trait_.id).map(Self::from))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue