Using contradictory or nonsensical combinations of file open options, such as read(true) with truncate(true), can lead to
code that is confusing and harder to read. In some cases, it can result in runtime errors or undefined behavior, potentially causing data corruption
or loss.
use std::fs::OpenOptions; OpenOptions::new().read(true).truncate(true); // Noncompliant: Invalid combination of file open options.
use std::fs::OpenOptions; OpenOptions::new().write(true).truncate(true); // Compliant: Valid combination of file open options.