Skip to content

Commit 79ed0f5

Browse files
committed
refactor(rust): format code with proper line breaks
- Format long string concatenation in ls tool to stay within 100 char limit - Split format! macro calls across multiple lines for better readability - Condense error formatting in worker navigation to single line - Update documentation comments to reference correct types - Format logging statements with proper line breaks for doc count - Format logging statements with proper line breaks for graph stats
1 parent 48e3be4 commit 79ed0f5

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

rust/src/agent/tools/worker/ls.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ pub fn ls(ctx: &DocContext, state: &WorkerState) -> ToolResult {
5555
ToolResult::ok(output)
5656
}
5757
None => {
58-
output.push_str("(no navigation data for this node)\nUse cat to read content or cd .. to go back.");
58+
output.push_str(
59+
"(no navigation data for this node)\nUse cat to read content or cd .. to go back.",
60+
);
5961
ToolResult::ok(output)
6062
}
6163
}

rust/src/agent/worker/execute.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ fn truncate_log(s: &str) -> std::borrow::Cow<'_, str> {
224224
if s.len() <= MAX {
225225
std::borrow::Cow::Borrowed(s)
226226
} else {
227-
std::borrow::Cow::Owned(format!("{}...(truncated, {} chars total)", &s[..MAX], s.len()))
227+
std::borrow::Cow::Owned(format!(
228+
"{}...(truncated, {} chars total)",
229+
&s[..MAX],
230+
s.len()
231+
))
228232
}
229233
}
230234

rust/src/agent/worker/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ impl<'a> Agent for Worker<'a> {
210210
.await
211211
.map_err(|e| Error::LlmReasoning {
212212
stage: "worker/navigation".to_string(),
213-
detail: format!(
214-
"Nav loop LLM call failed (round {round_num}): {e}"
215-
),
213+
detail: format!("Nav loop LLM call failed (round {round_num}): {e}"),
216214
})?;
217215
llm_calls += 1;
218216

rust/src/client/engine.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ impl Engine {
477477
/// as the retrieval agent progresses through navigation.
478478
///
479479
/// Supports single-document and multi-document scope.
480-
/// Events are translated from the agent's internal [`AgentEvent`](crate::agent::AgentEvent)
481-
/// into the public [`RetrieveEvent`] stream.
480+
/// Events are translated from the agent's internal event stream
481+
/// into the public `RetrieveEventReceiver` stream.
482482
pub async fn query_stream(&self, ctx: QueryContext) -> Result<RetrieveEventReceiver> {
483483
self.check_cancel()?;
484484
let _guard = self.inc_active();
@@ -1073,7 +1073,10 @@ impl Engine {
10731073

10741074
// Load all documents in parallel and extract keyword profiles
10751075
let doc_ids = self.workspace.inner().list_documents().await;
1076-
info!(doc_count = doc_ids.len(), "Loading documents for graph rebuild");
1076+
info!(
1077+
doc_count = doc_ids.len(),
1078+
"Loading documents for graph rebuild"
1079+
);
10771080
let concurrency = self.config.llm.throttle.max_concurrent_requests;
10781081

10791082
let loaded: Vec<Option<PersistedDocument>> = futures::stream::iter(doc_ids.iter().cloned())
@@ -1101,7 +1104,11 @@ impl Engine {
11011104
}
11021105

11031106
let graph = builder.build();
1104-
info!(nodes = graph.node_count(), edges = graph.edge_count(), "Graph built, persisting");
1107+
info!(
1108+
nodes = graph.node_count(),
1109+
edges = graph.edge_count(),
1110+
"Graph built, persisting"
1111+
);
11051112
self.workspace.set_graph(&graph).await?;
11061113
Ok(())
11071114
}

0 commit comments

Comments
 (0)