|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
| 15 | +use core::convert::TryFrom; |
| 16 | + |
15 | 17 | use crate::{ |
16 | 18 | block::{Error as BlockError, SectorRead}, |
17 | 19 | mem::MemoryRegion, |
18 | 20 | }; |
19 | | -use core::convert::TryFrom; |
20 | 21 |
|
21 | 22 | #[repr(packed)] |
22 | 23 | struct Header { |
@@ -311,7 +312,8 @@ impl<'a> Directory<'a> { |
311 | 312 | Ok(true) |
312 | 313 | } |
313 | 314 |
|
314 | | - // Returns and then increments to point to the next one, may return EndOfFile if this is the last entry |
| 315 | + // Returns and then increments to point to the next one, may return EndOfFile if |
| 316 | + // this is the last entry |
315 | 317 | pub fn next_entry(&mut self) -> Result<DirectoryEntry, Error> { |
316 | 318 | let mut long_entry = [0u16; 260]; |
317 | 319 | loop { |
@@ -501,7 +503,8 @@ impl<'a> Read for File<'a> { |
501 | 503 | self.active_cluster = self.start_cluster; |
502 | 504 | } |
503 | 505 |
|
504 | | - // Like read but without reading, follow cluster chain if we reach end of cluster |
| 506 | + // Like read but without reading, follow cluster chain if we reach end of |
| 507 | + // cluster |
505 | 508 | while self.position != position { |
506 | 509 | if self.sector_offset == u64::from(self.filesystem.sectors_per_cluster) { |
507 | 510 | match self.filesystem.next_cluster(self.active_cluster) { |
@@ -536,8 +539,9 @@ impl<'a> SectorRead for Filesystem<'a> { |
536 | 539 | } |
537 | 540 | } |
538 | 541 |
|
539 | | -// Do a case-insensitive match on the name with the 8.3 format that you get from FAT. |
540 | | -// In the FAT directory entry the "." isn't stored and any gaps are padded with " ". |
| 542 | +// Do a case-insensitive match on the name with the 8.3 format that you get from |
| 543 | +// FAT. In the FAT directory entry the "." isn't stored and any gaps are padded |
| 544 | +// with " ". |
541 | 545 | fn compare_short_name(name: &str, de: &DirectoryEntry) -> bool { |
542 | 546 | let name = name.trim_matches(char::from(0)); |
543 | 547 | // 8.3 (plus 1 for the separator) |
@@ -863,11 +867,12 @@ impl<'a> Filesystem<'a> { |
863 | 867 |
|
864 | 868 | #[cfg(test)] |
865 | 869 | mod tests { |
866 | | - use super::Read; |
867 | | - use crate::part::tests::*; |
868 | 870 | use std::convert::TryInto; |
869 | 871 | use std::path::PathBuf; |
870 | 872 |
|
| 873 | + use super::Read; |
| 874 | + use crate::part::tests::*; |
| 875 | + |
871 | 876 | fn fat_test_image_paths() -> Vec<PathBuf> { |
872 | 877 | let images = ["fat12.img", "fat16.img", "fat32.img"]; |
873 | 878 |
|
|
0 commit comments