mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Auto merge of #17348 - regexident:fix-type-or-const-param-source, r=Veykril
Use `.get(…)` instead of `[…]` in `TypeOrConstParam::source(…)` and `LifetimeParam::source(…)` Resolves #17344.
This commit is contained in:
commit
48bbdd6a74
1 changed files with 2 additions and 2 deletions
|
@ -202,7 +202,7 @@ impl HasSource for TypeOrConstParam {
|
|||
type Ast = Either<ast::TypeOrConstParam, ast::TraitOrAlias>;
|
||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||
let child_source = self.id.parent.child_source(db.upcast());
|
||||
Some(child_source.map(|it| it[self.id.local_id].clone()))
|
||||
child_source.map(|it| it.get(self.id.local_id).cloned()).transpose()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ impl HasSource for LifetimeParam {
|
|||
type Ast = ast::LifetimeParam;
|
||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||
let child_source = self.id.parent.child_source(db.upcast());
|
||||
Some(child_source.map(|it| it[self.id.local_id].clone()))
|
||||
child_source.map(|it| it.get(self.id.local_id).cloned()).transpose()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue