Skip to content

Commit 126bb43

Browse files
committed
Prefer usize::from over as usize
1 parent e49e86a commit 126bb43

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/dir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ impl LongNameBuilder {
884884
// last entry is actually first entry in stream
885885
self.index = index;
886886
self.chksum = data.checksum();
887-
self.buf.set_len(index as usize * LFN_PART_LEN);
887+
self.buf.set_len(usize::from(index) * LFN_PART_LEN);
888888
} else if self.index == 0 || index != self.index - 1 || data.checksum() != self.chksum {
889889
// Corrupted entry
890890
warn!(
@@ -900,7 +900,7 @@ impl LongNameBuilder {
900900
// Decrement LFN index only for non-last entries
901901
self.index -= 1;
902902
}
903-
let pos = LFN_PART_LEN * (index - 1) as usize;
903+
let pos = LFN_PART_LEN * usize::from(index - 1);
904904
// copy name parts into LFN buffer
905905
data.copy_name_to_slice(&mut self.buf.ucs2_units[pos..pos + 13]);
906906
}

src/dir_entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl ShortName {
102102
}
103103

104104
fn as_bytes(&self) -> &[u8] {
105-
&self.name[..self.len as usize]
105+
&self.name[..usize::from(self.len)]
106106
}
107107

108108
#[cfg(feature = "alloc")]

0 commit comments

Comments
 (0)