Skip to content

Commit

Permalink
style: implement clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kalvinnchau committed Jan 17, 2025
1 parent fea18c1 commit c664976
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/goose/src/agents/capabilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -327,6 +327,7 @@ impl Capabilities {
"Resource with uri '{}' not found. Here are the available systems: {}",
uri, available_systems
);

Err(ToolError::InvalidParameters(error_msg))
}

Expand All @@ -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(|_| {
Expand All @@ -366,7 +367,7 @@ impl Capabilities {
}
}

return Ok(result);
Ok(result)
}

async fn list_resources_from_system(
Expand Down

0 comments on commit c664976

Please sign in to comment.