Skip to content

Commit 9a28fc3

Browse files
committed
Fix warnings.
1 parent 4a6f78d commit 9a28fc3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/fs.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,14 @@ impl<TP: TimeProvider, OCC: OemCpConverter> FsOptions<TP, OCC> {
267267
}
268268

269269
/// Ignore a dirty file system and clear the dirty flag when mounting it.
270+
#[must_use]
270271
pub fn ignore_dirty_flag(mut self, enabled: bool) -> Self {
271272
self.ignore_dirty_flag = enabled;
272273
self
273274
}
274275

275276
/// Changes default OEM code page encoder-decoder.
277+
#[must_use]
276278
pub fn oem_cp_converter<OCC2: OemCpConverter>(self, oem_cp_converter: OCC2) -> FsOptions<TP, OCC2> {
277279
FsOptions::<TP, OCC2> {
278280
update_accessed_date: self.update_accessed_date,
@@ -283,6 +285,7 @@ impl<TP: TimeProvider, OCC: OemCpConverter> FsOptions<TP, OCC> {
283285
}
284286

285287
/// Changes default time provider.
288+
#[must_use]
286289
pub fn time_provider<TP2: TimeProvider>(self, time_provider: TP2) -> FsOptions<TP2, OCC> {
287290
FsOptions::<TP2, OCC> {
288291
update_accessed_date: self.update_accessed_date,
@@ -353,6 +356,8 @@ impl<T: std::io::Read + std::io::Write + std::io::Seek> IntoStorage<io::StdIoWra
353356
}
354357
}
355358

359+
type FatSlice<'f, IO, TP, OCC, E> = DiskSlice<FsIoAdapter<'f, IO, TP, OCC>, E>;
360+
356361
impl<IO: Read + Write + Seek, TP, OCC> FileSystem<IO, TP, OCC> {
357362
/// Creates a new filesystem object instance.
358363
///
@@ -393,14 +398,14 @@ impl<IO: Read + Write + Seek, TP, OCC> FileSystem<IO, TP, OCC> {
393398
let fat_type = FatType::from_clusters(total_clusters);
394399

395400
// read FSInfo sector if this is FAT32
396-
let mut fs_info = if fat_type == FatType::Fat32 {
401+
let fs_info = if fat_type == FatType::Fat32 {
397402
disk.seek(SeekFrom::Start(bpb.bytes_from_sectors(bpb.fs_info_sector())))?;
398403
FsInfoSector::deserialize(&mut disk)?
399404
} else {
400405
FsInfoSector::default()
401406
};
402407

403-
let mut fs = Self {
408+
let fs = Self {
404409
disk: RefCell::new(disk),
405410
options,
406411
fat_type,
@@ -487,15 +492,15 @@ impl<IO: Read + Write + Seek, TP, OCC> FileSystem<IO, TP, OCC> {
487492
self.bpb.clusters_from_bytes(bytes)
488493
}
489494

490-
fn fat_slice(&self) -> DiskSlice<FsIoAdapter<IO, TP, OCC>, IO::Error> {
495+
fn fat_slice(&self) -> FatSlice<'_, IO, TP, OCC, IO::Error> {
491496
let io = FsIoAdapter { fs: self };
492497
fat_slice(io, &self.bpb)
493498
}
494499

495500
pub(crate) fn cluster_iter(
496501
&self,
497502
cluster: u32,
498-
) -> ClusterIterator<DiskSlice<FsIoAdapter<IO, TP, OCC>, IO::Error>, IO::Error> {
503+
) -> ClusterIterator<FatSlice<'_, IO, TP, OCC, IO::Error>, IO::Error> {
499504
let disk_slice = self.fat_slice();
500505
ClusterIterator::new(disk_slice, self.fat_type, cluster)
501506
}
@@ -866,7 +871,7 @@ where
866871
}
867872
}
868873

869-
impl<B: BorrowMut<S>, E, S> Write for DiskSlice<B, E, S>
874+
impl<B, E, S> Write for DiskSlice<B, E, S>
870875
where
871876
B: BorrowMut<S>,
872877
E: IoError,

0 commit comments

Comments
 (0)