2024-01-25 18:17:36 +00:00
|
|
|
error: file opened with `create`, but `truncate` behavior not defined
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/open_options_fixable.rs:5:24
|
2024-01-25 18:17:36 +00:00
|
|
|
|
|
|
|
|
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)`
|
|
|
|
= help: if you instead know that you may want to keep some parts of the old file, call `.truncate(false)`
|
|
|
|
= help: alternatively, use `.append(true)` to append to the file instead of overwriting it
|
|
|
|
= 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 1 previous error
|
|
|
|
|