Skip to content

Commit b1345d6

Browse files
committed
refactor(rust): remove unused variable warnings and improve code quality
- Replace unused variables with underscore prefix to eliminate compiler warnings across multiple modules including workspace.rs, emitter.rs, executor.rs, aggregator.rs, llm_pilot.rs, reference.rs, retriever.rs, beam.rs, evaluate.rs, hybrid.rs, and threshold.rs - Remove overly permissive clippy allowances in lib.rs and replace with specific lint configurations for better code quality - Add SearchAlgorithm and QueryComplexity exports to main library interface - Include ReasoningIndexConfig in document type exports - These changes clean up code by addressing unused variable warnings while maintaining all existing functionality
1 parent 758ae11 commit b1345d6

12 files changed

Lines changed: 18 additions & 19 deletions

File tree

rust/src/client/workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl WorkspaceClient {
135135
let doc = self.workspace.load_and_cache(doc_id).await?;
136136
let cache_hit = doc.is_some();
137137

138-
if let Some(ref doc) = doc {
138+
if let Some(ref _doc) = doc {
139139
debug!("Loaded document: {} (cache={})", doc_id, cache_hit);
140140
}
141141

rust/src/events/emitter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ impl EventEmitter {
135135
for handler in &inner.index_handlers {
136136
handler(&event);
137137
}
138-
for handler in &inner.async_handlers {
138+
for _handler in &inner.async_handlers {
139139
// For sync context, we just log async handlers
140140
let event = Event::Index(event.clone());
141141
info!("Async event: {:?}", event);

rust/src/lib.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33

44
//! # Vectorless
55
6-
// Clippy: allow some pedantic lints that are too noisy for early-stage project
7-
#![allow(clippy::all)]
8-
#![allow(dead_code)]
9-
#![allow(unused_variables)]
6+
// Clippy: allow specific lints that are too noisy for this project
107
#![allow(clippy::iter_over_hash_type)]
118
#![allow(clippy::large_enum_variant)]
129
#![allow(clippy::manual_unwrap_or_default)]
@@ -69,14 +66,16 @@ pub use client::{
6966

7067
// Retrieval types
7168
pub use retrieval::StrategyPreference;
69+
pub use retrieval::pipeline::SearchAlgorithm;
70+
pub use retrieval::QueryComplexity;
7271

7372
// Error types
7473
pub use error::{Error, Result};
7574

7675
// Document types
7776
pub use document::{
78-
DocumentStructure, DocumentTree, NodeId, StructureNode, TocConfig, TocEntry, TocNode, TocView,
79-
TreeNode,
77+
DocumentStructure, DocumentTree, NodeId, ReasoningIndexConfig, StructureNode, TocConfig,
78+
TocEntry, TocNode, TocView, TreeNode,
8079
};
8180

8281
// Graph types

rust/src/llm/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl LlmExecutor {
353353
let truncated = self.truncate_prompt(user);
354354

355355
// Build request based on whether max_tokens is specified
356-
let request = if let Some(tokens) = max_tokens {
356+
let request = if let Some(_tokens) = max_tokens {
357357
CreateChatCompletionRequestArgs::default()
358358
.model(model)
359359
.messages([

rust/src/retrieval/content/aggregator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl ContentAggregator {
104104
tree: &DocumentTree,
105105
query: &str,
106106
) -> AggregationResult {
107-
let start = std::time::Instant::now();
107+
let _start = std::time::Instant::now();
108108

109109
// Step 1: Collect all content chunks from candidates and their descendants
110110
let chunks = self.collect_chunks(candidates, tree);

rust/src/retrieval/pilot/llm_pilot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ impl LlmPilot {
269269
fn compute_cache_key(
270270
&self,
271271
context: &super::builder::PilotContext,
272-
point: InterventionPoint,
272+
_point: InterventionPoint,
273273
) -> Option<MemoKey> {
274-
let store = self.memo_store.as_ref()?;
274+
let _store = self.memo_store.as_ref()?;
275275

276276
// Build a fingerprint from the context using available methods
277277
let context_str = context.to_string();

rust/src/retrieval/reference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl ReferenceFollower {
220220
};
221221

222222
// Use pre-extracted references if available, otherwise extract
223-
let refs = if !node.references.is_empty() {
223+
let _refs = if !node.references.is_empty() {
224224
node.references.clone()
225225
} else {
226226
ReferenceExtractor::extract(&node.content)
@@ -325,7 +325,7 @@ impl ReferenceFollower {
325325

326326
// Get references from this node
327327
if let Some(node) = tree.get(node_id) {
328-
let refs = if !node.references.is_empty() {
328+
let _refs = if !node.references.is_empty() {
329329
node.references.clone()
330330
} else {
331331
ReferenceExtractor::extract(&node.content)

rust/src/retrieval/retriever.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub trait Retriever: Send + Sync {
8181
///
8282
/// Returns an estimated number of LLM calls or tokens that will be used.
8383
/// Useful for cost-aware strategy selection.
84-
fn estimate_cost(&self, tree: &DocumentTree, options: &RetrieveOptions) -> CostEstimate {
84+
fn estimate_cost(&self, tree: &DocumentTree, _options: &RetrieveOptions) -> CostEstimate {
8585
let node_count = tree.node_count();
8686
CostEstimate {
8787
llm_calls: node_count / 2, // Rough estimate

rust/src/retrieval/search/beam.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl BeamSearch {
134134
tree: &DocumentTree,
135135
context: &RetrievalContext,
136136
pilot: Option<&dyn Pilot>,
137-
cache: &PilotDecisionCache,
137+
_cache: &PilotDecisionCache,
138138
visited: &HashSet<NodeId>,
139139
fallback_stack: &mut Vec<FallbackEntry>,
140140
result: &mut SearchResult,

rust/src/retrieval/stages/evaluate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl RetrievalStage for EvaluateStage {
410410
let doc_key = format!("{:?}", ctx.tree.root());
411411
for candidate in ctx.candidates.iter().take(3) {
412412
if let Some(node) = ctx.tree.get(candidate.node_id) {
413-
let path = format!("{}", node.depth);
413+
let _path = format!("{}", node.depth);
414414
// Use the node title as path identifier for L2
415415
ctx.reasoning_cache
416416
.l2_record(&doc_key, &node.title, candidate.score);

0 commit comments

Comments
 (0)