diff --git a/compiler/noirc_frontend/src/locations.rs b/compiler/noirc_frontend/src/locations.rs index b04ae757e8a..88f3424906f 100644 --- a/compiler/noirc_frontend/src/locations.rs +++ b/compiler/noirc_frontend/src/locations.rs @@ -78,7 +78,7 @@ impl NodeInterner { self.location_indices .get_node_from_location(reference_location) .and_then(|node_index| self.referenced_index(node_index)) - .and_then(|node_index| Some(self.dependency_location(self.reference_graph[node_index]))) + .map(|node_index| self.dependency_location(self.reference_graph[node_index])) } // Is the given location known to this interner? diff --git a/tooling/lsp/src/requests/goto_definition.rs b/tooling/lsp/src/requests/goto_definition.rs index aa75cf9bdda..158b8a1dc35 100644 --- a/tooling/lsp/src/requests/goto_definition.rs +++ b/tooling/lsp/src/requests/goto_definition.rs @@ -77,7 +77,9 @@ mod goto_definition_tests { let response = on_goto_definition_request(&mut state, params) .await .expect("Could execute on_goto_definition_request") - .expect(&format!("Didn't get a goto definition response for index {index}")); + .unwrap_or_else(|| { + panic!("Didn't get a goto definition response for index {index}") + }); if let GotoDefinitionResponse::Scalar(location) = response { assert_eq!(location.range, expected_range);