From 396e6d1188b46f3d484752e7ef11caf6b22f3021 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Fri, 1 Dec 2023 21:41:33 +0000 Subject: [PATCH] fix: impl Into --- compiler/noirc_frontend/src/hir/mod.rs | 4 +--- compiler/noirc_frontend/src/node_interner.rs | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/mod.rs b/compiler/noirc_frontend/src/hir/mod.rs index fff07db87ac..3a435f302af 100644 --- a/compiler/noirc_frontend/src/hir/mod.rs +++ b/compiler/noirc_frontend/src/hir/mod.rs @@ -185,9 +185,7 @@ impl Context { pub fn get_definition_location_from(&self, location: Location) -> Option { let interner = &self.def_interner; - interner - .find_location_index(location) - .and_then(|index| interner.resolve_location(&index.into())) + interner.find_location_index(location).and_then(|index| interner.resolve_location(index)) } /// Return a Vec of all `contract` declarations in the source code and the functions they contain diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index 01116dc8388..72bed209715 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -1221,11 +1221,11 @@ impl NodeInterner { /// For a given [Index] we return [Location] to which we resolved to /// We currently return None for features not yet implemented /// TODO(#3659): LSP goto def should error when Ident at Location could not resolve - pub(crate) fn resolve_location(&self, index_id: &Index) -> Option { - let node = self.nodes.get(*index_id)?; + pub(crate) fn resolve_location(&self, index: impl Into) -> Option { + let node = self.nodes.get(index.into())?; match node { - Node::Function(func) => self.resolve_location(&func.as_expr().into()), + Node::Function(func) => self.resolve_location(func.as_expr()), Node::Expression(expression) => self.resolve_expression_location(expression), _ => None, }