mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
13 lines
634 B
Text
13 lines
634 B
Text
|
error: file opened with `create`, but `truncate` behavior not defined
|
||
|
--> $DIR/open_options_fixable.rs:5:24
|
||
|
|
|
||
|
LL | OpenOptions::new().create(true).open("foo.txt");
|
||
|
| ^^^^^^^^^^^^- help: add: `.truncate(true)`
|
||
|
|
|
||
|
= help: if you intend to overwrite an existing file entirely, call `.truncate(true)`. if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
|
||
|
= note: `-D clippy::suspicious-open-options` implied by `-D warnings`
|
||
|
= help: to override `-D warnings` add `#[allow(clippy::suspicious_open_options)]`
|
||
|
|
||
|
error: aborting due to previous error
|
||
|
|