Skip to content

Commit 408f69a

Browse files
committed
Fixing test errors
1 parent ea18f0a commit 408f69a

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

crates/cli/src/commands/compare.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ use smart_diff_engine::{
1313
SimilarityScorer, ChangeClassifier, CrossFileTracker
1414
};
1515
use std::collections::HashMap;
16-
use std::fs;
1716
use std::path::{Path, PathBuf};
1817
use std::time::{Instant, Duration};
1918
use tokio::fs as async_fs;
20-
use tracing::{info, warn, error, debug};
19+
use tracing::{info, warn, debug};
2120

2221
pub async fn run(cli: Cli) -> Result<()> {
2322
if let Commands::Compare {
@@ -403,10 +402,10 @@ async fn process_file_pair(
403402
.with_context(|| format!("Failed to analyze target file: {}", target_file.display()))?;
404403

405404
// Initialize diff engine components
406-
let mut diff_engine = DiffEngine::new();
405+
let diff_engine = DiffEngine::new();
407406

408407
// Configure similarity scorer
409-
let mut similarity_scorer = SimilarityScorer::new(detected_language, smart_diff_engine::SimilarityScoringConfig::default());
408+
let similarity_scorer = SimilarityScorer::new(detected_language, smart_diff_engine::SimilarityScoringConfig::default());
410409
if ignore_whitespace {
411410
// Configure to ignore whitespace - would need to add this to SimilarityScorer
412411
debug!("Ignoring whitespace in similarity calculation");
@@ -546,7 +545,7 @@ fn calculate_function_similarities(
546545
target_symbols: &SymbolTable,
547546
similarity_scorer: &SimilarityScorer,
548547
) -> Result<HashMap<String, f64>> {
549-
let mut similarities: HashMap<String, f64> = HashMap::new();
548+
let similarities: HashMap<String, f64> = HashMap::new();
550549

551550
// Would need to iterate over functions from symbol table - simplified for now
552551
let similarities = HashMap::new();
@@ -704,7 +703,7 @@ fn format_duration(duration: Duration) -> String {
704703

705704
/// Extract functions from AST for comparison
706705
fn extract_functions_from_ast(ast: &smart_diff_parser::ASTNode) -> Vec<smart_diff_parser::Function> {
707-
use smart_diff_parser::{Function, FunctionSignature, Parameter, Type, NodeType};
706+
use smart_diff_parser::{Function, FunctionSignature, NodeType};
708707

709708
let mut functions = Vec::new();
710709

crates/cli/src/commands/config.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
//! Config command implementation
22
33
use crate::cli::{Cli, Commands, ConfigAction};
4-
use anyhow::{Result, Context, bail};
4+
use anyhow::{Result, bail};
55
use colored::*;
66
use console::Term;
77
use serde::{Deserialize, Serialize};
8-
use smart_diff_engine::RefactoringDetectionConfig;
9-
use std::collections::HashMap;
10-
use std::fs;
11-
use std::path::{Path, PathBuf};
12-
use tracing::{info, warn};
8+
use std::path::PathBuf;
139

1410
/// Application configuration structure
1511
#[derive(Debug, Clone, Serialize, Deserialize)]

crates/cli/src/commands/doctor.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
//! Doctor command implementation for system validation
22
33
use crate::cli::{Cli, Commands};
4-
use anyhow::{Result, Context};
4+
use anyhow::Result;
55
use colored::*;
66
use console::Term;
77
use smart_diff_parser::{tree_sitter::TreeSitterParser, Parser, LanguageDetector, Language};
88
use smart_diff_semantic::SemanticAnalyzer;
99
use smart_diff_engine::{DiffEngine, RefactoringDetector, SimilarityScorer};
10-
use std::collections::HashMap;
11-
use tracing::{info, warn, error};
1210

1311
pub async fn run(cli: Cli) -> Result<()> {
1412
if let Commands::Doctor { component, fix } = cli.command {
@@ -95,7 +93,7 @@ async fn check_parser_system(term: &Term, fix: bool, quiet: bool) -> Result<(usi
9593
}
9694

9795
let mut issues = 0;
98-
let mut fixes = 0;
96+
let fixes = 0;
9997

10098
// Test language detector
10199
let language_detector = LanguageDetector;
@@ -170,7 +168,7 @@ async fn check_semantic_system(term: &Term, fix: bool, quiet: bool) -> Result<(u
170168
}
171169

172170
let mut issues = 0;
173-
let mut fixes = 0;
171+
let fixes = 0;
174172

175173
// Test semantic analyzer creation
176174
let languages = vec![Language::Java, Language::Python, Language::JavaScript, Language::Cpp, Language::C];
@@ -230,7 +228,7 @@ async fn check_diff_engine(term: &Term, fix: bool, quiet: bool) -> Result<(usize
230228
}
231229

232230
let mut issues = 0;
233-
let mut fixes = 0;
231+
let fixes = 0;
234232

235233
// Test diff engine creation
236234
let languages = vec![Language::Java, Language::Python, Language::JavaScript, Language::Cpp, Language::C];
@@ -294,8 +292,8 @@ async fn check_language_support(term: &Term, fix: bool, quiet: bool) -> Result<(
294292
term.write_line(&format!("{}", "Checking Language Support...".bold()))?;
295293
}
296294

297-
let mut issues = 0;
298-
let mut fixes = 0;
295+
let issues = 0;
296+
let fixes = 0;
299297

300298
let supported_languages = vec![
301299
(Language::Java, vec!["java"]),
@@ -322,7 +320,7 @@ async fn check_configuration(term: &Term, fix: bool, quiet: bool) -> Result<(usi
322320
}
323321

324322
let mut issues = 0;
325-
let mut fixes = 0;
323+
let fixes = 0;
326324

327325
// Check if we can create default configurations
328326
let config_tests = vec![

crates/cli/src/output.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Output formatting utilities
22
33
use crate::cli::OutputFormat;
4-
use anyhow::{Result, Context};
4+
use anyhow::Result;
55
use colored::*;
6-
use serde::{Deserialize, Serialize};
6+
use serde::Serialize;
77
use smart_diff_parser::{Language, ASTNode};
88
use smart_diff_engine::{
99
DiffResult, RefactoringPattern, DetailedChangeClassification, FunctionMove

0 commit comments

Comments
 (0)