Closed
Description
I tried this code:
OpenOptions::new()
.write(true)
.create(true)
.open(&args.target)
and it creates a file even if it already exists
OpenOptions::new()
.write(true)
.create_new(true)
.open(&args.target)
This code creates a file only if the file does not exist
But look at the docs
For create()
I expected to see this happen: explanation
The functions to match their docs
Instead, this happened: explanation
They each do what the other is described to do
Meta
rustc --version --verbose
:
rustc 1.41.0 (5e1a79984 2020-01-27)
binary: rustc
commit-hash: 5e1a799842ba6ed4a57e91f7ab9435947482f7d8
commit-date: 2020-01-27
host: x86_64-unknown-linux-gnu
release: 1.41.0
LLVM version: 9.0
Backtrace
gitpod /workspace/nushell $ RUST_BACKTRACE=1 cargo build
Compiling nu v0.9.1 (/workspace/nushell)
Finished dev [unoptimized + debuginfo] target(s) in 26.35s