From 78f31696da489a30a08fc1c93e75ffbb79bcf726 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Wed, 5 Jun 2024 11:03:56 +0200 Subject: [PATCH] =?UTF-8?q?Resolve=20#17344=20by=20using=20`.get(=E2=80=A6?= =?UTF-8?q?)`=20instead=20of=20`[=E2=80=A6]`=20in=20`TypeOrConstParam::sou?= =?UTF-8?q?rce(=E2=80=A6)`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (… and `LifetimeParam::source(…)`) --- crates/hir/src/has_source.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index 7cdcdd76d1..308e8a31ca 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs @@ -202,7 +202,7 @@ impl HasSource for TypeOrConstParam { type Ast = Either; fn source(self, db: &dyn HirDatabase) -> Option> { 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> { 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() } }