File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 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 {
2626 let kind = match kind {
2727 VfsErrorKind :: IoError ( io) => match io. kind ( ) {
2828 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,
3032 _ => VfsErrorKind :: IoError ( io) ,
3133 } ,
3234 // 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 {
3535 /// Removes the directory at this path
3636 fn remove_dir ( & self , path : & str ) -> VfsResult < ( ) > ;
3737 /// 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 < ( ) > {
3939 Err ( VfsErrorKind :: NotSupported . into ( ) )
4040 }
4141 /// 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 < ( ) > {
4343 Err ( VfsErrorKind :: NotSupported . into ( ) )
4444 }
4545 /// 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 < ( ) > {
4747 Err ( VfsErrorKind :: NotSupported . into ( ) )
4848 }
4949}
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ impl FileSystem for MemoryFS {
162162 fn open_file ( & self , path : & str ) -> VfsResult < Box < dyn SeekAndRead > > {
163163 let handle = self . handle . read ( ) . unwrap ( ) ;
164164 let file = handle. files . get ( path) . ok_or ( VfsErrorKind :: FileNotFound ) ?;
165- ensure_file ( path , file) ?;
165+ ensure_file ( file) ?;
166166 Ok ( Box :: new ( ReadableFile {
167167 content : file. content . clone ( ) ,
168168 position : 0 ,
@@ -356,7 +356,7 @@ mod tests {
356356 }
357357}
358358
359- fn ensure_file ( path : & str , file : & MemoryFile ) -> VfsResult < ( ) > {
359+ fn ensure_file ( file : & MemoryFile ) -> VfsResult < ( ) > {
360360 if file. file_type != VfsFileType :: File {
361361 return Err ( VfsErrorKind :: Other ( "Not a file" . into ( ) ) . into ( ) ) ;
362362 }
You can’t perform that action at this time.
0 commit comments