Skip to content

Commit 40ca75e

Browse files
Test Userclaude
andcommitted
fix(fmt): clear cargo fmt drift in 3 crates (mcp_search, rlm, tinyclaw)
Reproduced on pristine origin/main (7b058b5): `cargo fmt --all -- --check` exited 1 with 13 diff blocks across 3 crates. Applied `cargo fmt --all` (canonical formatter, no manual edits) and verified --check now exits 0. Affected files (4): - crates/terraphim_mcp_search/src/lib.rs (1 block: use-list reorder) - crates/terraphim_mcp_search/src/search.rs (5 blocks: line wrapping) - crates/terraphim_rlm/src/mcp_tools.rs (6 blocks: use-list, closures) - crates/terraphim_tinyclaw/src/main.rs (1 block) Zero behavioural change — rustfmt is semantics-preserving. This is the fmt gate; the 3 clippy errors in mcp_tools.rs (doc_lazy_continuation x2, redundant_closure x1) are a separate concern tracked by #3008 and addressed by open PR #3012. PR #3012 fixes only those 3 clippy lines and leaves the fmt drift intact (verified: its own mcp_tools.rs is still fmt-dirty), so this PR does not duplicate it. Whichever PR merges second may need a trivial rebase on mcp_tools.rs (both are behaviour-preserving). Verification: - cargo fmt --all -- --check : exit 0 (was exit 1, 13 blocks) - Diff vs origin/main: 4 files, +24/-29 Refs #3013 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7b058b5 commit 40ca75e

4 files changed

Lines changed: 24 additions & 29 deletions

File tree

crates/terraphim_mcp_search/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ pub mod mcp_tool_index;
6060
pub mod search;
6161

6262
pub use mcp_tool_index::McpToolIndex;
63-
pub use search::{mcp_search_skills, mcp_search_tools, SkillEntry};
63+
pub use search::{SkillEntry, mcp_search_skills, mcp_search_tools};

crates/terraphim_mcp_search/src/search.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ pub fn mcp_search_skills(query: &str, skills: &[SkillEntry]) -> Vec<SkillEntry>
237237

238238
// Map the hits (Vec<&McpToolEntry>) back to input positions, then to
239239
// owned SkillEntry. Preserve input order.
240-
let hit_names: std::collections::HashSet<&str> =
241-
hits.iter().map(|t| t.name.as_str()).collect();
240+
let hit_names: std::collections::HashSet<&str> = hits.iter().map(|t| t.name.as_str()).collect();
242241
skills
243242
.iter()
244243
.filter(|s| hit_names.contains(s.name.as_str()))
@@ -262,8 +261,8 @@ mod tests {
262261

263262
#[test]
264263
fn test_skill_entry_with_tags() {
265-
let entry = SkillEntry::new("test", "Test skill")
266-
.with_tags(vec!["a".to_string(), "b".to_string()]);
264+
let entry =
265+
SkillEntry::new("test", "Test skill").with_tags(vec!["a".to_string(), "b".to_string()]);
267266
assert_eq!(entry.tags, vec!["a", "b"]);
268267
}
269268

@@ -314,7 +313,10 @@ mod tests {
314313
fn test_skill_entry_serde_skips_none() {
315314
let entry = SkillEntry::new("x", "y");
316315
let json = serde_json::to_string(&entry).unwrap();
317-
assert!(!json.contains("author"), "author should be skipped when None");
316+
assert!(
317+
!json.contains("author"),
318+
"author should be skipped when None"
319+
);
318320
// tags serializes as [] when empty (Vec<String> has no
319321
// skip_serializing_if); the property under test is "no None fields",
320322
// not "minimal JSON". The minimal-JSON contract is enforced by the
@@ -368,8 +370,7 @@ mod tests {
368370
#[test]
369371
fn test_mcp_search_skills_tag_match() {
370372
let skills = vec![
371-
SkillEntry::new("code-review", "review files")
372-
.with_tags(vec!["quality".to_string()]),
373+
SkillEntry::new("code-review", "review files").with_tags(vec!["quality".to_string()]),
373374
SkillEntry::new("deploy", "deploy things"),
374375
];
375376
let hits = mcp_search_skills("quality", &skills);
@@ -414,4 +415,4 @@ mod tests {
414415
assert_eq!(tool_hits.len(), 1);
415416
assert_eq!(skill_hits.len(), 1);
416417
}
417-
}
418+
}

crates/terraphim_rlm/src/mcp_tools.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use std::sync::Arc;
2929
use rmcp::model::{CallToolResult, Content, ErrorData, Tool};
3030
use serde::{Deserialize, Serialize};
3131
use serde_json::Map;
32-
use terraphim_mcp_search::{mcp_search_skills, mcp_search_tools, SkillEntry};
32+
use terraphim_mcp_search::{SkillEntry, mcp_search_skills, mcp_search_tools};
3333
use terraphim_types::McpToolEntry;
3434
use tokio::sync::RwLock;
3535

@@ -932,8 +932,7 @@ impl RlmMcpService {
932932
&self,
933933
arguments: Option<Map<String, serde_json::Value>>,
934934
) -> Result<CallToolResult, ErrorData> {
935-
let args =
936-
arguments.ok_or_else(|| ErrorData::invalid_params("Missing arguments", None))?;
935+
let args = arguments.ok_or_else(|| ErrorData::invalid_params("Missing arguments", None))?;
937936

938937
let query = args
939938
.get("query")
@@ -996,8 +995,7 @@ impl RlmMcpService {
996995
&self,
997996
arguments: Option<Map<String, serde_json::Value>>,
998997
) -> Result<CallToolResult, ErrorData> {
999-
let args =
1000-
arguments.ok_or_else(|| ErrorData::invalid_params("Missing arguments", None))?;
998+
let args = arguments.ok_or_else(|| ErrorData::invalid_params("Missing arguments", None))?;
1001999

10021000
let query = args
10031001
.get("query")
@@ -1167,13 +1165,12 @@ mod tests {
11671165
];
11681166

11691167
// Invoke via the public dispatch path
1170-
let args: serde_json::Map<String, serde_json::Value> = serde_json::from_value(
1171-
serde_json::json!({
1168+
let args: serde_json::Map<String, serde_json::Value> =
1169+
serde_json::from_value(serde_json::json!({
11721170
"query": "file",
11731171
"tools": tools,
1174-
}),
1175-
)
1176-
.unwrap();
1172+
}))
1173+
.unwrap();
11771174

11781175
let result = service
11791176
.call_tool("mcp_search_tools", Some(args))
@@ -1203,13 +1200,12 @@ mod tests {
12031200
SkillEntry::new("deploy", "Deploy to staging"),
12041201
];
12051202

1206-
let args: serde_json::Map<String, serde_json::Value> = serde_json::from_value(
1207-
serde_json::json!({
1203+
let args: serde_json::Map<String, serde_json::Value> =
1204+
serde_json::from_value(serde_json::json!({
12081205
"query": "review",
12091206
"skills": skills,
1210-
}),
1211-
)
1212-
.unwrap();
1207+
}))
1208+
.unwrap();
12131209

12141210
let result = service
12151211
.call_tool("mcp_search_skills", Some(args))
@@ -1231,10 +1227,8 @@ mod tests {
12311227
let service = RlmMcpService::new();
12321228

12331229
// Missing 'tools' parameter.
1234-
let args: serde_json::Map<String, serde_json::Value> = serde_json::from_value(
1235-
serde_json::json!({"query": "anything"}),
1236-
)
1237-
.unwrap();
1230+
let args: serde_json::Map<String, serde_json::Value> =
1231+
serde_json::from_value(serde_json::json!({"query": "anything"})).unwrap();
12381232
let result = service.call_tool("mcp_search_tools", Some(args)).await;
12391233
assert!(result.is_err(), "expected error for missing 'tools' param");
12401234

crates/terraphim_tinyclaw/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use clap::{Parser, Subcommand};
3030
use std::collections::HashMap;
3131
use std::path::PathBuf;
3232
use std::sync::Arc;
33-
use terraphim_mcp_search::{mcp_search_skills, SkillEntry};
33+
use terraphim_mcp_search::{SkillEntry, mcp_search_skills};
3434

3535
/// Multi-channel AI assistant powered by Terraphim.
3636
#[derive(Parser, Debug)]

0 commit comments

Comments
 (0)