Skip to content

Commit 1c00d6c

Browse files
committed
uses struct discriminates as hash key for native tools
1 parent 9e4c257 commit 1c00d6c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/chat-cli/src/cli/chat/cli/tools.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl ToolsArgs {
6060
session
6161
.conversation
6262
.tools
63-
.get("native")
63+
.get(&ToolOrigin::Native)
6464
.and_then(|tools| {
6565
tools
6666
.iter()
@@ -218,7 +218,7 @@ impl ToolsSubcommand {
218218
let native_tool_names = session
219219
.conversation
220220
.tools
221-
.get("native")
221+
.get(&ToolOrigin::Native)
222222
.map(|tools| {
223223
tools
224224
.iter()

crates/chat-cli/src/cli/chat/tools/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ pub enum ToolOrigin {
169169

170170
impl std::hash::Hash for ToolOrigin {
171171
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
172+
std::mem::discriminant(self).hash(state);
172173
match self {
173-
Self::Native => "native".hash(state),
174+
Self::Native => {},
174175
Self::McpServer(name) => name.hash(state),
175176
}
176177
}

0 commit comments

Comments
 (0)