@@ -63,7 +63,7 @@ impl FileSystem {
6363 let mut src = self
6464 . open ( src_path, UefiFileMode :: Read , false ) ?
6565 . into_regular_file ( )
66- . ok_or ( Error :: Io ( IoError {
66+ . ok_or_else ( || Error :: Io ( IoError {
6767 path : src_path. to_path_buf ( ) ,
6868 context : IoErrorContext :: NotAFile ,
6969 uefi_error : Status :: INVALID_PARAMETER . into ( ) ,
@@ -91,7 +91,7 @@ impl FileSystem {
9191 let mut dest = self
9292 . open ( dest_path, UefiFileMode :: CreateReadWrite , false ) ?
9393 . into_regular_file ( )
94- . ok_or ( Error :: Io ( IoError {
94+ . ok_or_else ( || Error :: Io ( IoError {
9595 path : dest_path. to_path_buf ( ) ,
9696 context : IoErrorContext :: OpenError ,
9797 uefi_error : Status :: INVALID_PARAMETER . into ( ) ,
@@ -198,7 +198,7 @@ impl FileSystem {
198198 let mut file = self
199199 . open ( path, UefiFileMode :: Read , false ) ?
200200 . into_regular_file ( )
201- . ok_or ( Error :: Io ( IoError {
201+ . ok_or_else ( || Error :: Io ( IoError {
202202 path : path. to_path_buf ( ) ,
203203 context : IoErrorContext :: NotAFile ,
204204 // We do not have a real UEFI error here as we have a logical
@@ -237,7 +237,7 @@ impl FileSystem {
237237 let dir = self
238238 . open ( path, UefiFileMode :: Read , false ) ?
239239 . into_directory ( )
240- . ok_or ( Error :: Io ( IoError {
240+ . ok_or_else ( || Error :: Io ( IoError {
241241 path : path. to_path_buf ( ) ,
242242 context : IoErrorContext :: NotADirectory ,
243243 // We do not have a real UEFI error here as we have a logical
0 commit comments