Skip to content

Commit db06494

Browse files
committed
Minor tidy up
match on enums, don't use if
1 parent 0b860bc commit db06494

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/fat/bpb.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,9 @@ impl<'a> Bpb<'a> {
8686

8787
/// Get the Volume Label string for this volume
8888
pub fn volume_label(&self) -> &[u8] {
89-
if self.fat_type != FatType::Fat32 {
90-
&self.data[43..=53]
91-
} else {
92-
&self.data[71..=81]
89+
match self.fat_type {
90+
FatType::Fat16 => &self.data[43..=53],
91+
FatType::Fat32 => &self.data[71..=81],
9392
}
9493
}
9594

@@ -98,10 +97,9 @@ impl<'a> Bpb<'a> {
9897
/// On a FAT32 volume, return the free block count from the Info Block. On
9998
/// a FAT16 volume, returns None.
10099
pub fn fs_info_block(&self) -> Option<BlockCount> {
101-
if self.fat_type != FatType::Fat32 {
102-
None
103-
} else {
104-
Some(BlockCount(u32::from(self.fs_info())))
100+
match self.fat_type {
101+
FatType::Fat16 => None,
102+
FatType::Fat32 => Some(BlockCount(u32::from(self.fs_info()))),
105103
}
106104
}
107105

0 commit comments

Comments
 (0)