Skip to content

Commit

Permalink
Use write_all
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Oct 3, 2021
1 parent 19b571f commit db6d841
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/create_test_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ impl Writer {
}

fn section(&mut self, title: &str) -> Result<()> {
self.file.write(&vec![0x42; 10])?;
self.file.write(title.as_bytes())?;
self.file.write(&vec![0x42; 10])?;
self.file.write_all(&vec![0x42; 10])?;
self.file.write_all(title.as_bytes())?;
self.file.write_all(&vec![0x42; 10])?;
Ok(())
}

fn add(&mut self, buf: &[u8]) -> Result<()> {
self.file.write(buf)?;
self.file.write_all(buf)?;
Ok(())
}
}
Expand Down

0 comments on commit db6d841

Please sign in to comment.