From c2876ed7e3bb541d04ca1e82a270219b22cf1b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 2 Feb 2024 12:06:03 +0100 Subject: [PATCH] Fix doc warnings --- src/driver.rs | 2 +- src/fs.rs | 11 +---------- src/io.rs | 2 +- src/object_safe.rs | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/driver.rs b/src/driver.rs index fb42103c0..942860822 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -32,7 +32,7 @@ pub trait Storage { /// Size of an erasable block in bytes, as unsigned typenum. /// Must be a multiple of both `READ_SIZE` and `WRITE_SIZE`. - /// At least 128 (https://git.io/JeHp9). Stored in superblock. + /// [At least 128](https://github.com/littlefs-project/littlefs/issues/264#issuecomment-519963153). Stored in superblock. const BLOCK_SIZE: usize; /// Number of erasable blocks. diff --git a/src/fs.rs b/src/fs.rs index 7c78fd9ce..96933668a 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -706,16 +706,7 @@ impl<'a, 'b, Storage: driver::Storage> File<'a, 'b, Storage> { /// Sync the file and drop it from the internal linked list. /// Not doing this is UB, which is why we have all the closure-based APIs. /// - /// TODO: check if this can be closed >1 times, if so make it safe - /// - /// Update: It seems like there's an assertion on a flag called `LFS_F_OPENED`: - /// https://github.com/littlefs-project/littlefs/blob/4c9146ea539f72749d6cc3ea076372a81b12cb11/lfs.c#L2549 - /// https://github.com/littlefs-project/littlefs/blob/4c9146ea539f72749d6cc3ea076372a81b12cb11/lfs.c#L2566 - /// - /// - On second call, shouldn't find ourselves in the "mlist of mdirs" - /// - Since we don't have dynamically allocated buffers, at least we don't hit the double-free. - /// - Not sure what happens in `lfs_file_sync`, but it should be easy to just error on - /// not LFS_F_OPENED... + /// This must not be called twice. pub unsafe fn close(self) -> Result<()> { let return_code = ll::lfs_file_close( &mut self.fs.alloc.borrow_mut().state, diff --git a/src/io.rs b/src/io.rs index 9f0f6ec70..b8ad5fdc1 100644 --- a/src/io.rs +++ b/src/io.rs @@ -84,7 +84,7 @@ impl SeekFrom { /// Enumeration of possible methods to seek within an file that was just opened /// Used in the [`read_chunk`](crate::fs::Filesystem::read_chunk) and [`write_chunk`](crate::fs::Filesystem::write_chunk) methods, -/// Where [`SeekFrom::Current`](SeekFrom::Current) would not make sense. +/// Where [`SeekFrom::Current`] would not make sense. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum OpenSeekFrom { Start(u32), diff --git a/src/object_safe.rs b/src/object_safe.rs index e347ccdc1..625001f34 100644 --- a/src/object_safe.rs +++ b/src/object_safe.rs @@ -68,7 +68,7 @@ impl dyn DynFile + '_ { /// Object-safe trait for [`Filesystem`][]. /// /// It contains these additional methods from [`Path`][]: -/// - [`DynStorage::exists`][] +/// - [`DynFilesystem::exists`][] /// /// The following methods are implemented in [`DynStorage`][] instead: /// - [`DynStorage::format`][]