mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Resolve #17344 by using .get(…)
instead of […]
in TypeOrConstParam::source(…)
(… and `LifetimeParam::source(…)`)
This commit is contained in:
parent
29e5cdfb05
commit
78f31696da
1 changed files with 2 additions and 2 deletions
|
@ -202,7 +202,7 @@ impl HasSource for TypeOrConstParam {
|
||||||
type Ast = Either<ast::TypeOrConstParam, ast::TraitOrAlias>;
|
type Ast = Either<ast::TypeOrConstParam, ast::TraitOrAlias>;
|
||||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||||
let child_source = self.id.parent.child_source(db.upcast());
|
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;
|
type Ast = ast::LifetimeParam;
|
||||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||||
let child_source = self.id.parent.child_source(db.upcast());
|
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…
Add table
Add a link
Reference in a new issue