Skip to content

Commit 3cfcc9f

Browse files
UnbreakableMJclaude
andcommitted
style(core): apply clippy idiom suggestions in ram_fat32
CI clippy flagged four lints in the new walker: - `manual_range_contains` × 2 → `(2..FAT32_END_OF_CHAIN).contains(&cluster)` / `!(2..FAT32_END_OF_CHAIN).contains(&cluster)`. - `manual_is_ascii_check` × 2 → `is_ascii_uppercase` / `is_ascii_lowercase`. Plus an `identity_op` (`x + 0x00`) in the LFN test fixture and the rustfmt re-flow that came with replacing the longer literals. No semantic change; 9/9 host walker tests + bios-boot-smoke all still pass locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 27d5941 commit 3cfcc9f

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

zamak-core/src/ram_fat32.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ impl<'a> RamFat32<'a> {
123123
let cluster_size = self.sectors_per_cluster as usize * SECTOR_SIZE;
124124
let mut cluster = facts.first_cluster;
125125
let mut written = 0;
126-
while written < total && cluster >= 2 && cluster < FAT32_END_OF_CHAIN {
126+
while written < total && (2..FAT32_END_OF_CHAIN).contains(&cluster) {
127127
let bytes = match self.cluster_bytes(cluster) {
128128
Some(b) => b,
129129
None => break,
@@ -221,7 +221,7 @@ impl<'a> RamFat32<'a> {
221221
ofs += DIR_ENTRY_SIZE;
222222
}
223223
cluster = self.next_cluster(cluster)?;
224-
if cluster < 2 || cluster >= FAT32_END_OF_CHAIN {
224+
if !(2..FAT32_END_OF_CHAIN).contains(&cluster) {
225225
return None;
226226
}
227227
}
@@ -335,7 +335,7 @@ fn ascii_eq_ignore_case(a: &[u8], b: &[u8]) -> bool {
335335
}
336336

337337
fn ascii_lower(b: u8) -> u8 {
338-
if (b'A'..=b'Z').contains(&b) {
338+
if b.is_ascii_uppercase() {
339339
b + 32
340340
} else {
341341
b
@@ -361,11 +361,7 @@ fn name_to_8_3(part: &str) -> [u8; 11] {
361361
if idx >= 11 {
362362
break;
363363
}
364-
out[idx] = if (b'a'..=b'z').contains(&ch) {
365-
ch - 32
366-
} else {
367-
ch
368-
};
364+
out[idx] = if ch.is_ascii_lowercase() { ch - 32 } else { ch };
369365
idx += 1;
370366
}
371367
out
@@ -446,7 +442,7 @@ mod tests {
446442

447443
// LFN entry. seq=1 with bit 0x40 set → "last" (only segment).
448444
// Checksum field at 0x0D — we don't validate it so leave 0.
449-
img[lfn + 0x00] = 0x41;
445+
img[lfn] = 0x41;
450446
img[lfn + 0x0B] = ATTR_LFN;
451447
let positions: [usize; 13] = [
452448
0x01, 0x03, 0x05, 0x07, 0x09, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1C, 0x1E,

0 commit comments

Comments
 (0)