clippy: Removes ineffective open options (#34599)

```
error: unnecessary use of `.write(true)` because there is `.append(true)`
  --> logger/src/lib.rs:61:9
   |
61 |         .write(true)
   |         ^^^^^^^^^^^^ help: remove `.write(true)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ineffective_open_options
   = note: `-D clippy::ineffective-open-options` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::ineffective_open_options)]`
```
This commit is contained in:
Brooks 2023-12-27 22:20:17 -05:00 committed by GitHub
parent 1f7c714acf
commit f8c3e24e73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 8 deletions

View File

@ -501,7 +501,6 @@ fn add_to_path(new_path: &str) -> bool {
fn append_file(dest: &Path, line: &str) -> io::Result<()> {
use std::io::Write;
let mut dest_file = fs::OpenOptions::new()
.write(true)
.append(true)
.create(true)
.open(dest)?;

View File

@ -58,7 +58,6 @@ pub fn setup() {
pub fn setup_file_with_default(logfile: &str, filter: &str) {
use std::fs::OpenOptions;
let file = OpenOptions::new()
.write(true)
.create(true)
.append(true)
.open(logfile)

View File

@ -24,12 +24,7 @@ pub mod dashboard;
#[cfg(unix)]
fn redirect_stderr(filename: &str) {
use std::os::unix::io::AsRawFd;
match OpenOptions::new()
.write(true)
.create(true)
.append(true)
.open(filename)
{
match OpenOptions::new().create(true).append(true).open(filename) {
Ok(file) => unsafe {
libc::dup2(file.as_raw_fd(), libc::STDERR_FILENO);
},