Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
clippy: Removes ineffective open options (#34599)
Browse files Browse the repository at this point in the history
```
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)]`
```
  • Loading branch information
brooksprumo authored Dec 28, 2023
1 parent 1f7c714 commit f8c3e24
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion install/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
1 change: 0 additions & 1 deletion logger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down

0 comments on commit f8c3e24

Please sign in to comment.