File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ async fn test_create_and_write() -> io::Result<()> {
2020 let mut file = File :: create ( & path) . await ?;
2121
2222 // Write 10 bytes to the file.
23- file. write ( b"some bytes" ) . await ?;
23+ file. write_all ( b"some bytes" ) . await ?;
2424 assert_eq ! ( file. metadata( ) . await . unwrap( ) . len( ) , 10 ) ;
2525
2626 remove_file ( & path) . unwrap ( ) ;
@@ -31,10 +31,10 @@ async fn test_create_and_read() -> io::Result<()> {
3131 let bytes = b"more bytes" ;
3232 let path = utils:: prepare_with_content ( "foo.txt" , bytes) ;
3333 let mut file = OpenOptions :: new ( ) . read ( true ) . open ( & path) . await . unwrap ( ) ;
34- let mut buffer = [ 0u8 ; 10 ] ;
34+ let mut buffer = vec ! [ ] ;
3535
3636 // Read the whole file.
37- file. read ( & mut buffer[ .. ] ) . await ?;
37+ file. read_to_end ( & mut buffer) . await ?;
3838 assert_eq ! ( & buffer, b"more bytes" ) ;
3939
4040 remove_file ( & path) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments