use File::options() instead of File::create()

This commit is contained in:
Sikkema, Isaac 2022-08-25 18:00:45 -04:00
parent 4d45b0745a
commit 06139e57d5

View file

@ -193,7 +193,7 @@ impl FileEncoder {
// shaves an instruction off those code paths (on x86 at least).
assert!(capacity <= usize::MAX - max_leb128_len());
let file = File::create(path)?;
let file = File::options().read(true).write(true).create(true).truncate(true).open(path)?;
Ok(FileEncoder {
buf: Box::new_uninit_slice(capacity),