Skip to content

Commit 26adcf7

Browse files
benmaddisonrbradford
authored andcommitted
fat,loader: reformat according to rustfmt suggestions
Signed-off-by: Ben Maddison <benm@workonline.africa>
1 parent c92f633 commit 26adcf7

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/fat.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use core::convert::TryFrom;
16+
1517
use crate::{
1618
block::{Error as BlockError, SectorRead},
1719
mem::MemoryRegion,
1820
};
19-
use core::convert::TryFrom;
2021

2122
#[repr(packed)]
2223
struct Header {
@@ -311,7 +312,8 @@ impl<'a> Directory<'a> {
311312
Ok(true)
312313
}
313314

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
315317
pub fn next_entry(&mut self) -> Result<DirectoryEntry, Error> {
316318
let mut long_entry = [0u16; 260];
317319
loop {
@@ -501,7 +503,8 @@ impl<'a> Read for File<'a> {
501503
self.active_cluster = self.start_cluster;
502504
}
503505

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
505508
while self.position != position {
506509
if self.sector_offset == u64::from(self.filesystem.sectors_per_cluster) {
507510
match self.filesystem.next_cluster(self.active_cluster) {
@@ -536,8 +539,9 @@ impl<'a> SectorRead for Filesystem<'a> {
536539
}
537540
}
538541

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 " ".
541545
fn compare_short_name(name: &str, de: &DirectoryEntry) -> bool {
542546
let name = name.trim_matches(char::from(0));
543547
// 8.3 (plus 1 for the separator)
@@ -863,11 +867,12 @@ impl<'a> Filesystem<'a> {
863867

864868
#[cfg(test)]
865869
mod tests {
866-
use super::Read;
867-
use crate::part::tests::*;
868870
use std::convert::TryInto;
869871
use std::path::PathBuf;
870872

873+
use super::Read;
874+
use crate::part::tests::*;
875+
871876
fn fat_test_image_paths() -> Vec<PathBuf> {
872877
let images = ["fat12.img", "fat16.img", "fat32.img"];
873878

src/loader.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,10 @@ pub fn load_default_entry(fs: &fat::Filesystem, info: &dyn boot::Info) -> Result
160160

161161
#[cfg(test)]
162162
mod tests {
163+
use core::convert::TryInto;
164+
163165
use crate::fat::Read;
164166
use crate::part::tests::*;
165-
use core::convert::TryInto;
166167

167168
#[test]
168169
fn test_default_entry() {

0 commit comments

Comments
 (0)