mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
lifetime transformation: refactoring & a new test
This commit is contained in:
parent
fe8f862757
commit
7f45cccda4
3 changed files with 45 additions and 10 deletions
|
@ -2637,10 +2637,14 @@ impl GenericDef {
|
|||
Either::Right(x) => GenericParam::TypeParam(x),
|
||||
}
|
||||
});
|
||||
self.lifetime_params(db).into_iter().chain(ty_params).collect()
|
||||
self.lifetime_params(db)
|
||||
.into_iter()
|
||||
.map(GenericParam::LifetimeParam)
|
||||
.chain(ty_params)
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn lifetime_params(self, db: &dyn HirDatabase) -> Vec<GenericParam> {
|
||||
pub fn lifetime_params(self, db: &dyn HirDatabase) -> Vec<LifetimeParam> {
|
||||
let generics = db.generic_params(self.into());
|
||||
generics
|
||||
.lifetimes
|
||||
|
@ -2648,7 +2652,6 @@ impl GenericDef {
|
|||
.map(|(local_id, _)| LifetimeParam {
|
||||
id: LifetimeParamId { parent: self.into(), local_id },
|
||||
})
|
||||
.map(GenericParam::LifetimeParam)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue