From c664976073b321ee2128370c8d42d358f650c0ee Mon Sep 17 00:00:00 2001 From: Kalvin Chau Date: Fri, 17 Jan 2025 10:58:32 -0800 Subject: [PATCH] style: implement clippy suggestions --- crates/goose/src/agents/capabilities.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/goose/src/agents/capabilities.rs b/crates/goose/src/agents/capabilities.rs index d89081ea2..bb01d6db0 100644 --- a/crates/goose/src/agents/capabilities.rs +++ b/crates/goose/src/agents/capabilities.rs @@ -308,7 +308,7 @@ impl Capabilities { // If system name is not provided, we need to search for the resource across all systems // Loop through each system and try to read the resource, don't raise an error if the resource is not found - for (system_name, _) in &self.clients { + for system_name in self.clients.keys() { let result = self.read_resource_from_system(uri, system_name).await; match result { Ok(result) => return Ok(result), @@ -327,6 +327,7 @@ impl Capabilities { "Resource with uri '{}' not found. Here are the available systems: {}", uri, available_systems ); + Err(ToolError::InvalidParameters(error_msg)) } @@ -349,7 +350,7 @@ impl Capabilities { let client = self .clients .get(system_name) - .ok_or_else(|| ToolError::InvalidParameters(error_msg))?; + .ok_or(ToolError::InvalidParameters(error_msg))?; let client_guard = client.lock().await; let read_result = client_guard.read_resource(uri).await.map_err(|_| { @@ -366,7 +367,7 @@ impl Capabilities { } } - return Ok(result); + Ok(result) } async fn list_resources_from_system(