File tree 1 file changed +2
-14
lines changed 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -872,8 +872,6 @@ impl<'a> Drop for Env<'a> {
872
872
#[ cfg( test) ]
873
873
mod tests {
874
874
use super :: * ;
875
- use std:: fs:: File ;
876
- use std:: io:: { Read , Write } ;
877
875
878
876
#[ test]
879
877
fn parse_version ( ) {
@@ -903,22 +901,12 @@ mod tests {
903
901
904
902
// Create the files.
905
903
for path in paths {
906
- File :: options ( )
907
- . write ( true )
908
- . create_new ( true )
909
- . open ( path)
910
- . expect ( "can create file" )
911
- . write_all ( CONFIG_DATA )
912
- . expect ( "can write contents" ) ;
904
+ std:: fs:: write ( path, CONFIG_DATA ) . expect ( "can write contents" ) ;
913
905
}
914
906
915
907
// Verify the files. This is mostly to show we really made a `\\?\...\NUL` on Windows.
916
908
for path in paths {
917
- let mut buf = Vec :: with_capacity ( CONFIG_DATA . len ( ) ) ;
918
- File :: open ( path)
919
- . expect ( "the file really exists" )
920
- . read_to_end ( & mut buf)
921
- . expect ( "can read contents" ) ;
909
+ let buf = std:: fs:: read ( path) . expect ( "the file really exists" ) ;
922
910
assert_eq ! ( buf, CONFIG_DATA , "File {path:?} should be created" ) ;
923
911
}
924
912
}
You can’t perform that action at this time.
0 commit comments