Skip to content

Commit 1c98baf

Browse files
committed
fix(codegraph-vector): remove unused imports and fix warnings
Remove unused imports and fix minor issues across codegraph-vector crate to eliminate compilation warnings. All changes are non-breaking. Changes: - memory.rs: Remove unused MmapMut import - openai_provider.rs: Remove unused error import from tracing - onnx_provider.rs: Remove unused Array import from ndarray - index.rs: Remove unused GpuResources import, make warn import conditional - consistency.rs: Remove unused async_trait import, prefix unused node_id parameter - incremental.rs: Remove unused async_trait, CodeNode, Hash, Hasher, Read imports - persistent.rs: Remove unused error import, fix unnecessary mut in quantizer training - storage.rs: Remove unused Read, Write, error, warn, Uuid imports, prefix unused config parameter - lib.rs: Add allow attribute for ambiguous StorageStats glob re-exports Summary: - Reduced warnings from 21 to 0 for default build - No functional changes or breaking changes - Library compiles cleanly without warnings
1 parent a81c8b1 commit 1c98baf

File tree

9 files changed

+17
-18
lines changed

9 files changed

+17
-18
lines changed

crates/codegraph-vector/src/consistency.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use async_trait::async_trait;
21
use codegraph_core::{CodeGraphError, NodeId, Result};
32
use parking_lot::{Mutex, RwLock};
43
use serde::{Deserialize, Serialize};
@@ -642,7 +641,7 @@ impl ConsistencyManager {
642641
/// Check if a node is visible to a transaction
643642
pub fn is_visible(
644643
&self,
645-
node_id: NodeId,
644+
_node_id: NodeId,
646645
transaction_id: u64,
647646
committed_by: Option<u64>,
648647
) -> bool {

crates/codegraph-vector/src/incremental.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
use async_trait::async_trait;
2-
use codegraph_core::{CodeGraphError, CodeNode, NodeId, Result};
1+
use codegraph_core::{CodeGraphError, NodeId, Result};
32
use crossbeam_channel::{unbounded, Receiver, Sender};
43
use dashmap::DashMap;
54
use parking_lot::{Mutex, RwLock};
65
use rayon::prelude::*;
76
use serde::{Deserialize, Serialize};
87
use std::collections::{HashMap, HashSet, VecDeque};
9-
use std::hash::{Hash, Hasher};
10-
use std::io::{Read, Write};
8+
use std::io::Write;
119
use std::sync::Arc;
1210
use std::time::{Duration, SystemTime, UNIX_EPOCH};
1311
use tokio::sync::mpsc as tokio_mpsc;

crates/codegraph-vector/src/index.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use serde::{Deserialize, Serialize};
99
use std::collections::HashMap;
1010
use std::path::PathBuf;
1111
use std::sync::Arc;
12-
use tracing::{debug, info, warn};
12+
use tracing::{debug, info};
13+
#[cfg(not(feature = "gpu"))]
14+
use tracing::warn;
1315

1416
/// Configuration for different FAISS index types optimized for various use cases
1517
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -227,7 +229,7 @@ impl FaissIndexManager {
227229
if self.config.gpu_enabled {
228230
#[cfg(feature = "gpu")]
229231
{
230-
use faiss::gpu::{GpuResources, StandardGpuResources};
232+
use faiss::gpu::StandardGpuResources;
231233

232234
let gpu_resources = StandardGpuResources::new().map_err(|e| {
233235
CodeGraphError::Vector(format!("Failed to initialize GPU resources: {}", e))

crates/codegraph-vector/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub use consistency::*;
8686
#[cfg(feature = "persistent")]
8787
pub use incremental::*;
8888
#[cfg(feature = "persistent")]
89+
#[allow(ambiguous_glob_reexports)]
8990
pub use persistent::*;
9091
#[cfg(feature = "persistent")]
9192
pub use storage::*;

crates/codegraph-vector/src/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use codegraph_core::{CodeGraphError, Result};
22
#[cfg(feature = "persistent")]
3-
use memmap2::{MmapMut, MmapOptions};
3+
use memmap2::MmapOptions;
44
use parking_lot::{Mutex, RwLock};
55
use serde::{Deserialize, Serialize};
66
use std::collections::HashMap;

crates/codegraph-vector/src/onnx_provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use codegraph_core::{CodeGraphError, CodeNode, Result};
99
#[cfg(feature = "onnx")]
1010
use hf_hub::api::tokio::Api;
1111
#[cfg(feature = "onnx")]
12-
use ndarray::{s, Array, Array2, Axis};
12+
use ndarray::{s, Array2, Axis};
1313
#[cfg(feature = "onnx")]
1414
use ort::execution_providers::CoreMLExecutionProvider;
1515
#[cfg(feature = "onnx")]

crates/codegraph-vector/src/openai_provider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::{
1818
};
1919
use tokenizers::Tokenizer;
2020
use tokio::time::timeout;
21-
use tracing::{debug, error, info, warn};
21+
use tracing::{debug, info, warn};
2222

2323
/// Configuration for OpenAI embedding provider
2424
#[derive(Debug, Clone)]

crates/codegraph-vector/src/persistent.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
99
use std::sync::Arc;
1010
use std::time::{SystemTime, UNIX_EPOCH};
1111
use tokio::fs;
12-
use tracing::{debug, error, info, warn};
12+
use tracing::{debug, info, warn};
1313

1414
/// Header for the memory-mapped vector storage file
1515
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -914,13 +914,13 @@ impl PersistentVectorStore {
914914
}
915915

916916
// Train PQ if enabled
917-
if let Some(mut pq) = self.pq_quantizer.write().as_mut() {
917+
if let Some(pq) = self.pq_quantizer.write().as_mut() {
918918
pq.train(sample_vectors)?;
919919
info!("Trained product quantizer");
920920
}
921921

922922
// Train SQ if enabled
923-
if let Some(mut sq) = self.sq_quantizer.write().as_mut() {
923+
if let Some(sq) = self.sq_quantizer.write().as_mut() {
924924
sq.train(sample_vectors)?;
925925
info!("Trained scalar quantizer");
926926
}

crates/codegraph-vector/src/storage.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ use parking_lot::RwLock;
88
use serde::{Deserialize, Serialize};
99
use std::collections::HashMap;
1010
use std::fs::{File, OpenOptions};
11-
use std::io::{BufReader, BufWriter, Read, Write};
11+
use std::io::{BufReader, BufWriter};
1212
use std::path::{Path, PathBuf};
1313
use std::sync::Arc;
14-
use tracing::{debug, error, info, warn};
15-
use uuid::Uuid;
14+
use tracing::{debug, info};
1615

1716
/// Metadata for persistent vector storage
1817
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -164,7 +163,7 @@ impl PersistentStorage {
164163
}
165164

166165
/// Load FAISS index from disk with automatic decompression
167-
pub fn load_index(&self, config: &IndexConfig) -> Result<IndexImpl> {
166+
pub fn load_index(&self, _config: &IndexConfig) -> Result<IndexImpl> {
168167
let index_path = self.base_path.join(Self::INDEX_FILE);
169168

170169
if !index_path.exists() {

0 commit comments

Comments
 (0)