Skip to content

Commit d94acd6

Browse files
unhappychoiceclaude
andcommitted
fix: resolve remaining clippy warnings for CI compliance
- Add #[allow(dead_code)] for unused methods and fields - Add #[allow(clippy::too_many_arguments)] for complex display functions - Replace .max().min() patterns with .clamp() - Fix needless range loops with iterator patterns - Replace len() >= 1 with !is_empty() - Fix manual range contains patterns - Improve struct initialization patterns 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0cb638a commit d94acd6

20 files changed

+70
-32
lines changed

src/extractor/parser.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl CodeExtractor {
125125

126126
// Process files in parallel with better progress tracking
127127
// Split files into smaller chunks for better progress visibility
128-
let chunk_size = (total_files / 20).max(1).min(10); // Process in smaller chunks of 1-10 files
128+
let chunk_size = (total_files / 20).clamp(1, 10); // Process in smaller chunks of 1-10 files
129129
let mut all_chunks = Vec::new();
130130
let mut processed_files = 0;
131131

@@ -157,6 +157,7 @@ impl CodeExtractor {
157157
Ok(all_chunks)
158158
}
159159

160+
#[allow(dead_code)]
160161
fn should_process_file(&self, path: &Path, options: &ExtractionOptions) -> bool {
161162
Self::should_process_file_static(path, options)
162163
}
@@ -211,6 +212,7 @@ impl CodeExtractor {
211212
Self::extract_chunks_from_tree_static(&tree, &content, file_path, language, options)
212213
}
213214

215+
#[allow(dead_code)]
214216
fn extract_chunks_from_tree(
215217
&self,
216218
tree: &Tree,
@@ -232,8 +234,7 @@ impl CodeExtractor {
232234
let mut chunks = Vec::new();
233235

234236
// Extract comment ranges for the entire file
235-
let file_comment_ranges =
236-
Self::extract_comment_ranges_static(tree, source_code, language);
237+
let file_comment_ranges = Self::extract_comment_ranges_static(tree, source_code, language);
237238

238239
let query_str = match language {
239240
Language::Rust => "
@@ -283,6 +284,8 @@ impl CodeExtractor {
283284
Ok(chunks)
284285
}
285286

287+
#[allow(dead_code)]
288+
#[allow(clippy::too_many_arguments)]
286289
fn node_to_chunk(
287290
&self,
288291
node: Node,
@@ -373,6 +376,7 @@ impl CodeExtractor {
373376
})
374377
}
375378

379+
#[allow(dead_code)]
376380
fn extract_name(&self, node: Node, source_code: &str) -> Option<String> {
377381
Self::extract_name_static(node, source_code)
378382
}
@@ -412,6 +416,7 @@ impl CodeExtractor {
412416
None
413417
}
414418

419+
#[allow(dead_code)]
415420
fn normalize_indentation(
416421
&self,
417422
content: &str,
@@ -521,6 +526,7 @@ impl CodeExtractor {
521526
(normalized_text, final_ranges)
522527
}
523528

529+
#[allow(dead_code)]
524530
fn extract_comment_ranges(
525531
&self,
526532
tree: &Tree,

src/extractor/repository_loader.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ impl RepositoryLoader {
143143
Ok(())
144144
}
145145

146-
collect_recursive(repo_path, &extensions, &mut files)
147-
.map_err(GitTypeError::IoError)?;
146+
collect_recursive(repo_path, &extensions, &mut files).map_err(GitTypeError::IoError)?;
148147

149148
Ok(files)
150149
}

src/game/ascii_digits.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// ASCII art digit patterns using oh-my-logo style with simple block font
22
/// Each digit has consistent width within its own pattern for proper alignment
3-
43
pub fn get_digit_patterns() -> [Vec<&'static str>; 10] {
54
[
65
// 0 - width 7

src/game/display.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ impl GameDisplay {
3434
)
3535
}
3636

37+
#[allow(clippy::too_many_arguments)]
3738
pub fn display_challenge_with_info(
3839
challenge_text: &str,
3940
current_position: usize,

src/game/display_optimized.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ impl GameDisplayOptimized {
3232
}
3333
}
3434

35+
#[allow(clippy::too_many_arguments)]
3536
pub fn display_challenge_with_info(
3637
&mut self,
3738
challenge_text: &str,
@@ -169,6 +170,7 @@ impl GameDisplayOptimized {
169170
Ok(())
170171
}
171172

173+
#[allow(clippy::too_many_arguments)]
172174
fn display_content(
173175
&self,
174176
stdout: &mut std::io::Stdout,
@@ -269,6 +271,7 @@ impl GameDisplayOptimized {
269271
Ok(())
270272
}
271273

274+
#[allow(clippy::too_many_arguments)]
272275
fn render_character_optimized(
273276
&self,
274277
stdout: &mut std::io::Stdout,
@@ -376,6 +379,7 @@ impl GameDisplayOptimized {
376379
Ok(())
377380
}
378381

382+
#[allow(clippy::too_many_arguments)]
379383
fn display_metrics(
380384
&self,
381385
stdout: &mut std::io::Stdout,

src/game/display_ratatui.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ impl GameDisplayRatatui {
3030
})
3131
}
3232

33+
#[allow(clippy::too_many_arguments)]
3334
pub fn display_challenge_with_info(
3435
&mut self,
3536
challenge_text: &str,

src/game/screens/exit_summary_screen.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,16 @@ impl ExitSummaryScreen {
192192
if session_summary.total_challenges_completed > 0 {
193193
let performance_start_row = stats_start_row + stats_lines.len() as u16 + 1;
194194

195-
let performance_lines = [format!(
195+
let performance_lines = [
196+
format!(
196197
"Best Stage: {:.1} WPM, {:.1}% accuracy",
197198
session_summary.best_stage_wpm, session_summary.best_stage_accuracy
198199
),
199200
format!(
200201
"Worst Stage: {:.1} WPM, {:.1}% accuracy",
201202
session_summary.worst_stage_wpm, session_summary.worst_stage_accuracy
202-
)];
203+
),
204+
];
203205

204206
for (i, line) in performance_lines.iter().enumerate() {
205207
let line_col = center_col.saturating_sub(line.len() as u16 / 2);
@@ -508,7 +510,9 @@ impl ExitSummaryScreen {
508510
loop {
509511
if event::poll(std::time::Duration::from_millis(100))? {
510512
if let Event::Key(key_event) = event::read()? {
511-
if key_event.code == KeyCode::Esc { break }
513+
if key_event.code == KeyCode::Esc {
514+
break;
515+
}
512516
}
513517
}
514518
}

src/game/screens/info_dialog.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ impl InfoDialog {
208208
loop {
209209
if let Ok(true) = event::poll(std::time::Duration::from_millis(50)) {
210210
if let Ok(Event::Key(key_event)) = event::read() {
211-
if key_event.code == KeyCode::Esc { break }
211+
if key_event.code == KeyCode::Esc {
212+
break;
213+
}
212214
}
213215
}
214216
}

src/game/screens/result_screen.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ impl ResultScreen {
180180
let stage_metrics_row = score_start_row + ascii_height + 2;
181181

182182
// Display compact metrics below the score
183-
let metrics_lines = [format!(
183+
let metrics_lines = [
184+
format!(
184185
"CPM: {:.0} | WPM: {:.0} | Time: {:.1}s",
185186
metrics.cpm,
186187
metrics.wpm,
@@ -189,7 +190,8 @@ impl ResultScreen {
189190
format!(
190191
"Keystrokes: {} | Accuracy: {:.1}% | Mistakes: {}",
191192
keystrokes, metrics.accuracy, metrics.mistakes
192-
)];
193+
),
194+
];
193195

194196
for (i, line) in metrics_lines.iter().enumerate() {
195197
let line_col = center_col.saturating_sub(line.len() as u16 / 2);
@@ -399,7 +401,8 @@ impl ResultScreen {
399401
let summary_start_row = score_start_row + ascii_height + 2;
400402

401403
// Display session summary with compact format like other screens
402-
let summary_lines = [format!(
404+
let summary_lines = [
405+
format!(
403406
"CPM: {:.0} | WPM: {:.0} | Time: {:.1}s",
404407
session_metrics.cpm,
405408
session_metrics.wpm,
@@ -413,7 +416,8 @@ impl ResultScreen {
413416
.sum::<usize>(),
414417
session_metrics.accuracy,
415418
session_metrics.mistakes
416-
)];
419+
),
420+
];
417421

418422
for (i, line) in summary_lines.iter().enumerate() {
419423
let line_col = center_col.saturating_sub(line.len() as u16 / 2);
@@ -454,10 +458,12 @@ impl ResultScreen {
454458
}
455459

456460
// Display options
457-
let options = ["[R] Retry",
461+
let options = [
462+
"[R] Retry",
458463
"[S] Share Result",
459464
"[T] Back to Title",
460-
"[ESC] Quit"];
465+
"[ESC] Quit",
466+
];
461467

462468
let options_start = if !stage_engines.is_empty() {
463469
let stage_results_start_row = summary_start_row + summary_lines.len() as u16 + 2;

src/game/screens/title_screen.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,14 @@ impl TitleScreen {
130130
git_info: Option<&GitRepositoryInfo>,
131131
) -> Result<()> {
132132
// ASCII logo lines
133-
let logo_lines = ["─╔═══╗─╔══╗─╔════╗────╔════╗─╔╗──╔╗─╔═══╗─╔═══╗─",
133+
let logo_lines = [
134+
"─╔═══╗─╔══╗─╔════╗────╔════╗─╔╗──╔╗─╔═══╗─╔═══╗─",
134135
"─║╔═╗║─╚╣╠╝─║╔╗╔╗║────║╔╗╔╗║─║╚╗╔╝║─║╔═╗║─║╔══╝─",
135136
"─║║─╚╝──║║──╚╝║║╚╝────╚╝║║╚╝─╚╗╚╝╔╝─║╚═╝║─║╚══╗─",
136137
"─║║╔═╗──║║────║║────────║║────╚╗╔╝──║╔══╝─║╔══╝─",
137138
"─║╚╩═║─╔╣╠╗───║║────────║║─────║║───║║────║╚══╗─",
138-
"─╚═══╝─╚══╝───╚╝────────╚╝─────╚╝───╚╝────╚═══╝─"];
139+
"─╚═══╝─╚══╝───╚╝────────╚╝─────╚╝───╚╝────╚═══╝─",
140+
];
139141

140142
// Display ASCII logo
141143
let logo_width = logo_lines[0].chars().count() as u16;

0 commit comments

Comments
 (0)