Skip to content

Commit 401fe6a

Browse files
committed
fix: resolve remaining clippy warnings
1 parent 0d43702 commit 401fe6a

File tree

10 files changed

+732
-555
lines changed

10 files changed

+732
-555
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/src/benchmark.rs

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
22
use code_guardian_core::{
3-
DetectorFactory, DetectorProfile, OptimizedScanner, Scanner, StreamingScanner,
4-
BenchmarkSuite, BenchmarkConfigurations, PerformanceAnalyzer,
3+
BenchmarkConfigurations, BenchmarkSuite, DetectorFactory, DetectorProfile, OptimizedScanner,
4+
PerformanceAnalyzer, Scanner, StreamingScanner,
55
};
66
use std::path::Path;
77
use std::time::Instant;
@@ -122,6 +122,7 @@ pub fn run_benchmark(path: &Path) -> Result<()> {
122122
}
123123

124124
/// Run comprehensive benchmark suite
125+
#[allow(dead_code)]
125126
pub fn run_comprehensive_benchmark(path: &Path, suite_type: &str) -> Result<()> {
126127
println!("🚀 Code-Guardian Comprehensive Benchmark");
127128
println!("=========================================\n");
@@ -144,14 +145,15 @@ pub fn run_comprehensive_benchmark(path: &Path, suite_type: &str) -> Result<()>
144145
};
145146

146147
suite.run_benchmarks(path)?;
147-
148+
148149
// Generate detailed report
149150
generate_benchmark_report(&suite)?;
150-
151+
151152
Ok(())
152153
}
153154

154155
/// Run all benchmark suites
156+
#[allow(dead_code)]
155157
pub fn run_all_benchmark_suites(path: &Path) -> Result<()> {
156158
println!("🏃‍♂️ Running All Benchmark Suites");
157159
println!("==================================\n");
@@ -160,7 +162,10 @@ pub fn run_all_benchmark_suites(path: &Path) -> Result<()> {
160162
("Small Project", BenchmarkConfigurations::small_project()),
161163
("Medium Project", BenchmarkConfigurations::medium_project()),
162164
("Large Project", BenchmarkConfigurations::large_project()),
163-
("Regression Detection", BenchmarkConfigurations::regression_detection()),
165+
(
166+
"Regression Detection",
167+
BenchmarkConfigurations::regression_detection(),
168+
),
164169
];
165170

166171
let mut all_results = Vec::new();
@@ -170,7 +175,7 @@ pub fn run_all_benchmark_suites(path: &Path) -> Result<()> {
170175
for (name, mut suite) in suites {
171176
println!("🔄 Running {} Suite...", name);
172177
suite.run_benchmarks(path)?;
173-
178+
174179
total_passed += suite.summary.passed_tests;
175180
total_tests += suite.summary.total_tests;
176181
all_results.push((name, suite));
@@ -183,7 +188,7 @@ pub fn run_all_benchmark_suites(path: &Path) -> Result<()> {
183188
println!("Total Tests: {}", total_tests);
184189
println!("Total Passed: ✅ {}", total_passed);
185190
println!("Total Failed: ❌ {}", total_tests - total_passed);
186-
191+
187192
let success_rate = (total_passed as f64 / total_tests as f64) * 100.0;
188193
println!("Success Rate: {:.1}%", success_rate);
189194

@@ -199,12 +204,13 @@ pub fn run_all_benchmark_suites(path: &Path) -> Result<()> {
199204
}
200205

201206
/// Run performance analysis with detailed metrics
207+
#[allow(dead_code)]
202208
pub fn run_performance_analysis(path: &Path) -> Result<()> {
203209
println!("🔍 Performance Analysis");
204210
println!("======================\n");
205211

206212
let mut analyzer = PerformanceAnalyzer::new();
207-
213+
208214
analyzer.analyze_performance(|| {
209215
// Run a comprehensive scan for analysis
210216
let scanner = OptimizedScanner::new(DetectorProfile::Comprehensive.get_detectors())
@@ -224,13 +230,17 @@ pub fn run_performance_analysis(path: &Path) -> Result<()> {
224230
}
225231

226232
/// Generate comprehensive benchmark report
233+
#[allow(dead_code)]
227234
fn generate_benchmark_report(suite: &BenchmarkSuite) -> Result<()> {
228235
println!("\n📊 Detailed Benchmark Report");
229236
println!("============================");
230-
237+
231238
println!("Suite: {}", suite.name);
232-
println!("Performance Score: {:.1}/100", suite.summary.performance_score);
233-
239+
println!(
240+
"Performance Score: {:.1}/100",
241+
suite.summary.performance_score
242+
);
243+
234244
if !suite.results.is_empty() {
235245
println!("\n📈 Individual Test Results:");
236246
for result in &suite.results {
@@ -257,40 +267,45 @@ fn generate_benchmark_report(suite: &BenchmarkSuite) -> Result<()> {
257267
}
258268

259269
/// Save benchmark report to file
270+
#[allow(dead_code)]
260271
fn save_benchmark_report(suite: &BenchmarkSuite) -> Result<()> {
261272
use std::fs;
262273
use std::path::PathBuf;
263-
274+
264275
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
265-
let filename = format!("benchmark_report_{}_{}.json",
266-
suite.name.replace(" ", "_").to_lowercase(), timestamp);
267-
276+
let filename = format!(
277+
"benchmark_report_{}_{}.json",
278+
suite.name.replace(" ", "_").to_lowercase(),
279+
timestamp
280+
);
281+
268282
let reports_dir = PathBuf::from("reports");
269283
fs::create_dir_all(&reports_dir)?;
270-
284+
271285
let report_path = reports_dir.join(filename);
272286
let json_report = serde_json::to_string_pretty(suite)?;
273287
fs::write(&report_path, json_report)?;
274-
288+
275289
println!("\n📄 Report saved to: {}", report_path.display());
276290
Ok(())
277291
}
278292

279293
/// Save performance analysis to file
280-
fn save_performance_analysis(analyzer: &PerformanceAnalyzer, path: &Path) -> Result<()> {
294+
#[allow(dead_code)]
295+
fn save_performance_analysis(analyzer: &PerformanceAnalyzer, _path: &Path) -> Result<()> {
281296
use std::fs;
282297
use std::path::PathBuf;
283-
298+
284299
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
285300
let filename = format!("performance_analysis_{}.json", timestamp);
286-
301+
287302
let reports_dir = PathBuf::from("reports");
288303
fs::create_dir_all(&reports_dir)?;
289-
304+
290305
let report_path = reports_dir.join(filename);
291306
let json_analysis = serde_json::to_string_pretty(analyzer)?;
292307
fs::write(&report_path, json_analysis)?;
293-
308+
294309
println!("\n📄 Analysis saved to: {}", report_path.display());
295310
Ok(())
296311
}

crates/cli/src/command_handlers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ pub fn handle_benchmark(path: Option<PathBuf>, quick: bool) -> Result<()> {
5656
}
5757

5858
/// Handle comprehensive benchmark command with suite selection
59+
#[allow(dead_code)]
5960
pub fn handle_comprehensive_benchmark(path: Option<PathBuf>, suite: String) -> Result<()> {
6061
let benchmark_path = path.unwrap_or_else(|| std::env::current_dir().unwrap());
6162
benchmark::run_comprehensive_benchmark(&benchmark_path, &suite)
6263
}
6364

6465
/// Handle performance analysis command
66+
#[allow(dead_code)]
6567
pub fn handle_performance_analysis(path: Option<PathBuf>) -> Result<()> {
6668
let analysis_path = path.unwrap_or_else(|| std::env::current_dir().unwrap());
6769
benchmark::run_performance_analysis(&analysis_path)

0 commit comments

Comments
 (0)