@@ -17,36 +17,36 @@ const TEST_STR2: &str = "Rust is cool!\n";
17
17
18
18
type FileSystem = fatfs:: FileSystem < StdIoWrapper < BufStream < fs:: File > > , DefaultTimeProvider , LossyOemCpConverter > ;
19
19
20
- fn call_with_tmp_img < F : Fn ( & str ) -> ( ) > ( f : F , filename : & str , test_seq : u32 ) {
20
+ fn call_with_tmp_img < F : Fn ( & str ) > ( f : F , filename : & str , test_seq : u32 ) {
21
21
let _ = env_logger:: builder ( ) . is_test ( true ) . try_init ( ) ;
22
22
let img_path = format ! ( "{}/{}" , IMG_DIR , filename) ;
23
23
let tmp_path = format ! ( "{}/{}-{}" , TMP_DIR , test_seq, filename) ;
24
24
fs:: create_dir ( TMP_DIR ) . ok ( ) ;
25
- fs:: copy ( & img_path, & tmp_path) . unwrap ( ) ;
25
+ fs:: copy ( img_path, & tmp_path) . unwrap ( ) ;
26
26
f ( tmp_path. as_str ( ) ) ;
27
27
fs:: remove_file ( tmp_path) . unwrap ( ) ;
28
28
}
29
29
30
30
fn open_filesystem_rw ( tmp_path : & str ) -> FileSystem {
31
- let file = fs:: OpenOptions :: new ( ) . read ( true ) . write ( true ) . open ( & tmp_path) . unwrap ( ) ;
31
+ let file = fs:: OpenOptions :: new ( ) . read ( true ) . write ( true ) . open ( tmp_path) . unwrap ( ) ;
32
32
let buf_file = BufStream :: new ( file) ;
33
33
let options = FsOptions :: new ( ) . update_accessed_date ( true ) ;
34
34
FileSystem :: new ( buf_file, options) . unwrap ( )
35
35
}
36
36
37
- fn call_with_fs < F : Fn ( FileSystem ) -> ( ) > ( f : F , filename : & str , test_seq : u32 ) {
37
+ fn call_with_fs < F : Fn ( FileSystem ) > ( f : F , filename : & str , test_seq : u32 ) {
38
38
let callback = |tmp_path : & str | {
39
39
let fs = open_filesystem_rw ( tmp_path) ;
40
40
f ( fs) ;
41
41
} ;
42
- call_with_tmp_img ( & callback, filename, test_seq) ;
42
+ call_with_tmp_img ( callback, filename, test_seq) ;
43
43
}
44
44
45
45
fn test_write_short_file ( fs : FileSystem ) {
46
46
let root_dir = fs. root_dir ( ) ;
47
47
let mut file = root_dir. open_file ( "short.txt" ) . expect ( "open file" ) ;
48
48
file. truncate ( ) . unwrap ( ) ;
49
- file. write_all ( & TEST_STR . as_bytes ( ) ) . unwrap ( ) ;
49
+ file. write_all ( TEST_STR . as_bytes ( ) ) . unwrap ( ) ;
50
50
file. seek ( io:: SeekFrom :: Start ( 0 ) ) . unwrap ( ) ;
51
51
let mut buf = Vec :: new ( ) ;
52
52
file. read_to_end ( & mut buf) . unwrap ( ) ;
@@ -73,7 +73,7 @@ fn test_write_long_file(fs: FileSystem) {
73
73
let mut file = root_dir. open_file ( "long.txt" ) . expect ( "open file" ) ;
74
74
file. truncate ( ) . unwrap ( ) ;
75
75
let test_str = TEST_STR . repeat ( 1000 ) ;
76
- file. write_all ( & test_str. as_bytes ( ) ) . unwrap ( ) ;
76
+ file. write_all ( test_str. as_bytes ( ) ) . unwrap ( ) ;
77
77
file. seek ( io:: SeekFrom :: Start ( 0 ) ) . unwrap ( ) ;
78
78
let mut buf = Vec :: new ( ) ;
79
79
file. read_to_end ( & mut buf) . unwrap ( ) ;
@@ -147,7 +147,7 @@ fn test_create_file(fs: FileSystem) {
147
147
let mut file = root_dir
148
148
. create_file ( "very/long/path/new-file-with-long-name.txt" )
149
149
. unwrap ( ) ;
150
- file. write_all ( & TEST_STR . as_bytes ( ) ) . unwrap ( ) ;
150
+ file. write_all ( TEST_STR . as_bytes ( ) ) . unwrap ( ) ;
151
151
}
152
152
// check for dir entry
153
153
names = dir. iter ( ) . map ( |r| r. unwrap ( ) . file_name ( ) ) . collect :: < Vec < String > > ( ) ;
@@ -340,21 +340,21 @@ fn test_dirty_flag(tmp_path: &str) {
340
340
// Open filesystem, make change, and forget it - should become dirty
341
341
let fs = open_filesystem_rw ( tmp_path) ;
342
342
let status_flags = fs. read_status_flags ( ) . unwrap ( ) ;
343
- assert_eq ! ( status_flags. dirty( ) , false ) ;
344
- assert_eq ! ( status_flags. io_error( ) , false ) ;
343
+ assert ! ( ! status_flags. dirty( ) ) ;
344
+ assert ! ( ! status_flags. io_error( ) ) ;
345
345
fs. root_dir ( ) . create_file ( "abc.txt" ) . unwrap ( ) ;
346
346
mem:: forget ( fs) ;
347
347
// Check if volume is dirty now
348
348
let fs = open_filesystem_rw ( tmp_path) ;
349
349
let status_flags = fs. read_status_flags ( ) . unwrap ( ) ;
350
- assert_eq ! ( status_flags. dirty( ) , true ) ;
351
- assert_eq ! ( status_flags. io_error( ) , false ) ;
350
+ assert ! ( status_flags. dirty( ) ) ;
351
+ assert ! ( ! status_flags. io_error( ) ) ;
352
352
fs. unmount ( ) . unwrap ( ) ;
353
353
// Make sure remounting does not clear the dirty flag
354
354
let fs = open_filesystem_rw ( tmp_path) ;
355
355
let status_flags = fs. read_status_flags ( ) . unwrap ( ) ;
356
- assert_eq ! ( status_flags. dirty( ) , true ) ;
357
- assert_eq ! ( status_flags. io_error( ) , false ) ;
356
+ assert ! ( status_flags. dirty( ) ) ;
357
+ assert ! ( ! status_flags. io_error( ) ) ;
358
358
}
359
359
360
360
#[ test]
@@ -388,15 +388,15 @@ fn test_multiple_files_in_directory(fs: FileSystem) {
388
388
389
389
#[ test]
390
390
fn test_multiple_files_in_directory_fat12 ( ) {
391
- call_with_fs ( & test_multiple_files_in_directory, FAT12_IMG , 8 )
391
+ call_with_fs ( test_multiple_files_in_directory, FAT12_IMG , 8 )
392
392
}
393
393
394
394
#[ test]
395
395
fn test_multiple_files_in_directory_fat16 ( ) {
396
- call_with_fs ( & test_multiple_files_in_directory, FAT16_IMG , 8 )
396
+ call_with_fs ( test_multiple_files_in_directory, FAT16_IMG , 8 )
397
397
}
398
398
399
399
#[ test]
400
400
fn test_multiple_files_in_directory_fat32 ( ) {
401
- call_with_fs ( & test_multiple_files_in_directory, FAT32_IMG , 8 )
401
+ call_with_fs ( test_multiple_files_in_directory, FAT32_IMG , 8 )
402
402
}
0 commit comments