Skip to content

Commit c2d29db

Browse files
committed
clippy auto fix but some more should be polished
1 parent f454fb7 commit c2d29db

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

src/fat/volume.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ impl FatVolume {
623623
lfn_buffer.push(&buffer);
624624
SeqState::Complete { csum }
625625
}
626-
(true, sequence, _) if sequence >= 0x02 && sequence < 0x14 => {
626+
(true, sequence, _) if (0x02..0x14).contains(&sequence) => {
627627
lfn_buffer.clear();
628628
lfn_buffer.push(&buffer);
629629
SeqState::Remaining {
@@ -636,7 +636,7 @@ impl FatVolume {
636636
SeqState::Complete { csum }
637637
}
638638
(false, sequence, SeqState::Remaining { csum, next })
639-
if sequence >= 0x01 && sequence < 0x13 && next == sequence =>
639+
if (0x01..0x13).contains(&sequence) && next == sequence =>
640640
{
641641
lfn_buffer.push(&buffer);
642642
SeqState::Remaining {
@@ -796,10 +796,7 @@ impl FatVolume {
796796
}
797797
}
798798
}
799-
current_cluster = match self.next_cluster(block_cache, cluster).await {
800-
Ok(n) => Some(n),
801-
_ => None,
802-
};
799+
current_cluster = (self.next_cluster(block_cache, cluster).await).ok();
803800
}
804801
Ok(())
805802
}
@@ -876,10 +873,7 @@ impl FatVolume {
876873
x => return x,
877874
}
878875
}
879-
current_cluster = match self.next_cluster(block_cache, cluster).await {
880-
Ok(n) => Some(n),
881-
_ => None,
882-
}
876+
current_cluster = (self.next_cluster(block_cache, cluster).await).ok()
883877
}
884878
Err(Error::NotFound)
885879
}
@@ -1014,10 +1008,7 @@ impl FatVolume {
10141008
}
10151009
}
10161010
// Find the next cluster
1017-
current_cluster = match self.next_cluster(block_cache, cluster).await {
1018-
Ok(n) => Some(n),
1019-
_ => None,
1020-
}
1011+
current_cluster = (self.next_cluster(block_cache, cluster).await).ok()
10211012
}
10221013
// Ok, give up
10231014
}
@@ -1432,9 +1423,7 @@ where
14321423
return Err(Error::BadBlockSize(bpb.bytes_per_block()));
14331424
}
14341425
// FirstDataSector = BPB_ResvdSecCnt + (BPB_NumFATs * FATSz) + RootDirSectors;
1435-
let root_dir_blocks = ((u32::from(bpb.root_entries_count()) * OnDiskDirEntry::LEN_U32)
1436-
+ (Block::LEN_U32 - 1))
1437-
/ Block::LEN_U32;
1426+
let root_dir_blocks = (u32::from(bpb.root_entries_count()) * OnDiskDirEntry::LEN_U32).div_ceil(Block::LEN_U32);
14381427
let first_root_dir_block =
14391428
fat_start + BlockCount(u32::from(bpb.num_fats()) * bpb.fat_size());
14401429
let first_data_block = first_root_dir_block + BlockCount(root_dir_blocks);

src/volume_mgr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ where
767767
if maybe_volume_name.is_none()
768768
&& de.attributes == Attributes::create_from_fat(Attributes::VOLUME)
769769
{
770-
maybe_volume_name = Some(unsafe { de.name.clone().to_volume_label() })
770+
maybe_volume_name = Some(unsafe { de.name.to_volume_label() })
771771
}
772772
})
773773
.await?;

0 commit comments

Comments
 (0)