2023-10-26 05:30:12 -05:00
|
|
|
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)`
|
|
|
|
|
|
2024-01-13 17:11:42 -06:00
|
|
|
= 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
|
2023-10-26 05:30:12 -05:00
|
|
|
= note: `-D clippy::suspicious-open-options` implied by `-D warnings`
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::suspicious_open_options)]`
|
|
|
|
|
2024-01-11 06:49:49 -06:00
|
|
|
error: aborting due to 1 previous error
|
2023-10-26 05:30:12 -05:00
|
|
|
|