File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -58,9 +58,7 @@ at your option.
5858
5959use std:: {
6060 collections:: btree_map:: { self , BTreeMap } ,
61- env, fmt,
62- fs:: { self , File } ,
63- io:: { self , Read } ,
61+ env, fmt, fs, io,
6462 path:: { Path , PathBuf } ,
6563 sync:: Mutex ,
6664 time:: SystemTime ,
@@ -216,17 +214,10 @@ fn sanitize_crate_name<S: AsRef<str>>(name: S) -> String {
216214
217215/// Open the given `Cargo.toml` and parse it into a hashmap.
218216fn open_cargo_toml ( path : & Path ) -> Result < Table , Error > {
219- let mut content = String :: new ( ) ;
220- File :: open ( path)
221- . map_err ( |e| Error :: CouldNotRead {
222- source : e,
223- path : path. into ( ) ,
224- } ) ?
225- . read_to_string ( & mut content)
226- . map_err ( |e| Error :: CouldNotRead {
227- source : e,
228- path : path. into ( ) ,
229- } ) ?;
217+ let content = fs:: read_to_string ( path) . map_err ( |e| Error :: CouldNotRead {
218+ source : e,
219+ path : path. into ( ) ,
220+ } ) ?;
230221 toml:: from_str ( & content) . map_err ( |e| Error :: InvalidToml { source : e } )
231222}
232223
You can’t perform that action at this time.
0 commit comments