Skip to content

Commit b61a4d4

Browse files
snowmeadclaude
andcommitted
fix: Resolve CI formatting and clippy errors
- Fix formatting for if-let chain patterns in downloader.rs and indexer.rs - Remove unused imports and functions in integration_tests.rs - Add #[allow(dead_code)] to TaskResult enum - Use inlined format args in println! statements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 28ccef7 commit b61a4d4

File tree

3 files changed

+19
-30
lines changed

3 files changed

+19
-30
lines changed

rust-docs-mcp/src/cache/downloader.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ impl CrateDownloader {
216216

217217
// Report progress if callback provided and total size known
218218
if let Some(ref callback) = progress_callback
219-
&& total_bytes > 0 {
220-
let percent = ((downloaded_bytes * 100) / total_bytes).min(100) as u8;
221-
callback(percent);
222-
}
219+
&& total_bytes > 0
220+
{
221+
let percent = ((downloaded_bytes * 100) / total_bytes).min(100) as u8;
222+
callback(percent);
223+
}
223224
}
224225

225226
// Extract the crate

rust-docs-mcp/src/search/indexer.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,11 @@ impl SearchIndexer {
177177

178178
// Report progress every 50 items during document creation (0-70%)
179179
if let Some(ref callback) = progress_callback
180-
&& (i % 50 == 0 || i == total_items - 1) {
181-
let percent = ((i * 70) / total_items.max(1)).min(70) as u8;
182-
callback(percent);
183-
}
180+
&& (i % 50 == 0 || i == total_items - 1)
181+
{
182+
let percent = ((i * 70) / total_items.max(1)).min(70) as u8;
183+
callback(percent);
184+
}
184185
}
185186

186187
// Then add all documents to the writer
@@ -190,10 +191,11 @@ impl SearchIndexer {
190191

191192
// Report progress during writing (70-95%)
192193
if let Some(ref callback) = progress_callback
193-
&& (i % 50 == 0 || i == documents.len() - 1) {
194-
let percent = (70 + ((i * 25) / documents.len().max(1))).min(95) as u8;
195-
callback(percent);
196-
}
194+
&& (i % 50 == 0 || i == documents.len() - 1)
195+
{
196+
let percent = (70 + ((i * 25) / documents.len().max(1))).min(95) as u8;
197+
callback(percent);
198+
}
197199
}
198200

199201
writer.commit()?;

rust-docs-mcp/tests/integration_tests.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rust_docs_mcp::RustDocsService;
1111
use rust_docs_mcp::analysis::outputs::StructureOutput;
1212
use rust_docs_mcp::analysis::tools::AnalyzeCrateStructureParams;
1313
use rust_docs_mcp::cache::outputs::{
14-
CacheCrateOutput, CacheTaskStartedOutput, GetCratesMetadataOutput, ListCrateVersionsOutput,
14+
CacheTaskStartedOutput, GetCratesMetadataOutput, ListCrateVersionsOutput,
1515
};
1616
use rust_docs_mcp::cache::tools::{
1717
CacheCrateParams, CacheOperationsParams, CrateMetadataQuery, GetCratesMetadataParams,
@@ -29,7 +29,6 @@ use rust_docs_mcp::docs::tools::{
2929
};
3030
use rust_docs_mcp::search::outputs::SearchItemsFuzzyOutput;
3131
use rust_docs_mcp::search::tools::SearchItemsFuzzyParams;
32-
use std::collections::HashMap;
3332
use std::time::Duration;
3433
use tempfile::TempDir;
3534

@@ -49,20 +48,6 @@ fn parse_cache_task_started(response: &str) -> Result<CacheTaskStartedOutput> {
4948
})
5049
}
5150

52-
fn parse_cache_response(response: &str) -> Result<CacheCrateOutput> {
53-
serde_json::from_str(response)
54-
.map_err(|e| anyhow::anyhow!("Failed to parse cache response: {e}\nResponse: {response}"))
55-
}
56-
57-
fn is_binary_only_response(response: &str) -> bool {
58-
// Binary-only packages will return an error with this message
59-
if let Ok(output) = parse_cache_response(response) {
60-
matches!(output, CacheCrateOutput::Error { error } if error.contains("binary-only") || error.contains("no library"))
61-
} else {
62-
false
63-
}
64-
}
65-
6651
/// Helper to create a test service with temporary cache
6752
fn create_test_service() -> Result<(RustDocsService, TempDir)> {
6853
let temp_dir = TempDir::new()?;
@@ -72,6 +57,7 @@ fn create_test_service() -> Result<(RustDocsService, TempDir)> {
7257

7358
/// Result of waiting for a caching task
7459
#[derive(Debug)]
60+
#[allow(dead_code)]
7561
enum TaskResult {
7662
Success,
7763
WorkspaceDetected(String), // Contains workspace info
@@ -1518,7 +1504,7 @@ async fn test_step_tracking() -> Result<()> {
15181504
.map(|(c, t, _)| *c == current && *t == total)
15191505
.unwrap_or(false);
15201506
if !last_matches {
1521-
println!("Step update: {} of {} {:?}", current, total, desc);
1507+
println!("Step update: {current} of {total} {desc:?}");
15221508
step_updates.push((current, total, desc));
15231509
}
15241510
}
@@ -1535,7 +1521,7 @@ async fn test_step_tracking() -> Result<()> {
15351521
tokio::time::sleep(poll_interval).await;
15361522
}
15371523

1538-
println!("Step updates observed: {:?}", step_updates);
1524+
println!("Step updates observed: {step_updates:?}");
15391525

15401526
// Verify step tracking requirements:
15411527

0 commit comments

Comments
 (0)