Skip to content

Commit c08c0a2

Browse files
ukyclaude
authored andcommitted
fix: resolve clippy errors in main.rs for Linux CI
- Use enumerate+skip+take instead of indexing loop variable - Merge consecutive str::replace into replace with char array - Use is_multiple_of instead of % 2 != 0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7f4b482 commit c08c0a2

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/main.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -864,18 +864,13 @@ mod linux {
864864
let line_idx = loc.line as usize;
865865
let start = line_idx.saturating_sub(4);
866866
let end = (line_idx + 3).min(lines.len());
867-
for i in start..end {
867+
for (i, line) in lines.iter().enumerate().skip(start).take(end - start) {
868868
let marker = if i + 1 == line_idx { ">" } else { " " };
869869
let line_num = format!("{:4}", i + 1);
870870
if i + 1 == line_idx {
871-
println!(
872-
" {} {} {}",
873-
marker.green().bold(),
874-
line_num.green(),
875-
lines[i]
876-
);
871+
println!(" {} {} {}", marker.green().bold(), line_num.green(), line);
877872
} else {
878-
println!(" {} {} {}", marker, line_num.dimmed(), lines[i]);
873+
println!(" {} {} {}", marker, line_num.dimmed(), line);
879874
}
880875
}
881876
}
@@ -2267,9 +2262,9 @@ mod linux {
22672262
fn parse_hex_bytes(s: &str) -> anyhow::Result<Vec<u8>> {
22682263
let s = s.strip_prefix("0x").unwrap_or(s);
22692264
// Remove any whitespace or \x separators
2270-
let clean: String = s.replace("\\x", "").replace(' ', "").replace(':', "");
2265+
let clean: String = s.replace("\\x", "").replace([' ', ':'], "");
22712266

2272-
if clean.len() % 2 != 0 {
2267+
if !clean.len().is_multiple_of(2) {
22732268
return Err(anyhow::anyhow!(
22742269
"hex string must have even number of digits, got {}",
22752270
clean.len()

0 commit comments

Comments
 (0)