File tree 3 files changed +8
-6
lines changed
3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,9 @@ impl From<VfsErrorKind> for VfsError {
26
26
let kind = match kind {
27
27
VfsErrorKind :: IoError ( io) => match io. kind ( ) {
28
28
io:: ErrorKind :: NotFound => VfsErrorKind :: FileNotFound ,
29
- io:: ErrorKind :: Unsupported => VfsErrorKind :: NotSupported ,
29
+ // TODO: If MSRV changes to 1.53, enable this. Alternatively,
30
+ // if it's possible to #[cfg] just this line, try that
31
+ // io::ErrorKind::Unsupported => VfsErrorKind::NotSupported,
30
32
_ => VfsErrorKind :: IoError ( io) ,
31
33
} ,
32
34
// Remaining kinda are passed through as-is
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ pub trait FileSystem: Debug + Sync + Send + 'static {
35
35
/// Removes the directory at this path
36
36
fn remove_dir ( & self , path : & str ) -> VfsResult < ( ) > ;
37
37
/// Copies the src path to the destination path within the same filesystem (optional)
38
- fn copy_file ( & self , _src : & str , dest : & str ) -> VfsResult < ( ) > {
38
+ fn copy_file ( & self , _src : & str , _dest : & str ) -> VfsResult < ( ) > {
39
39
Err ( VfsErrorKind :: NotSupported . into ( ) )
40
40
}
41
41
/// Moves the src path to the destination path within the same filesystem (optional)
42
- fn move_file ( & self , _src : & str , dest : & str ) -> VfsResult < ( ) > {
42
+ fn move_file ( & self , _src : & str , _dest : & str ) -> VfsResult < ( ) > {
43
43
Err ( VfsErrorKind :: NotSupported . into ( ) )
44
44
}
45
45
/// Moves the src directory to the destination path within the same filesystem (optional)
46
- fn move_dir ( & self , _src : & str , dest : & str ) -> VfsResult < ( ) > {
46
+ fn move_dir ( & self , _src : & str , _dest : & str ) -> VfsResult < ( ) > {
47
47
Err ( VfsErrorKind :: NotSupported . into ( ) )
48
48
}
49
49
}
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ impl FileSystem for MemoryFS {
162
162
fn open_file ( & self , path : & str ) -> VfsResult < Box < dyn SeekAndRead > > {
163
163
let handle = self . handle . read ( ) . unwrap ( ) ;
164
164
let file = handle. files . get ( path) . ok_or ( VfsErrorKind :: FileNotFound ) ?;
165
- ensure_file ( path , file) ?;
165
+ ensure_file ( file) ?;
166
166
Ok ( Box :: new ( ReadableFile {
167
167
content : file. content . clone ( ) ,
168
168
position : 0 ,
@@ -356,7 +356,7 @@ mod tests {
356
356
}
357
357
}
358
358
359
- fn ensure_file ( path : & str , file : & MemoryFile ) -> VfsResult < ( ) > {
359
+ fn ensure_file ( file : & MemoryFile ) -> VfsResult < ( ) > {
360
360
if file. file_type != VfsFileType :: File {
361
361
return Err ( VfsErrorKind :: Other ( "Not a file" . into ( ) ) . into ( ) ) ;
362
362
}
You can’t perform that action at this time.
0 commit comments