File tree Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Expand file tree Collapse file tree 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change 4646use crate :: { elf:: parser, error:: VMError , memory:: MemorySegmentImage } ;
4747
4848use elf:: { endian:: LittleEndian , ElfBytes } ;
49- use std:: fs:: File ;
49+ use std:: fs:: { self , File } ;
5050use std:: path:: Path ;
5151
5252use super :: { error:: ParserError , parser:: ParsedElfData } ;
@@ -122,11 +122,7 @@ impl ElfFile {
122122 }
123123
124124 pub fn from_path < P : AsRef < Path > + ?Sized > ( path : & P ) -> Result < Self , VMError > {
125- let file = File :: open ( path) . map_err ( Into :: < ParserError > :: into) ?;
126-
127- let data: Vec < u8 > = std:: io:: Read :: bytes ( file)
128- . map ( |b| b. expect ( "Failed to read byte" ) )
129- . collect ( ) ;
125+ let data = fs:: read ( path. as_ref ( ) ) . map_err ( Into :: < ParserError > :: into) ?;
130126 Self :: from_bytes ( data. as_slice ( ) )
131127 }
132128}
You can’t perform that action at this time.
0 commit comments