Replace OpenOptions::new with File::options to be readable (#3059)

## Issue Addressed

Closes #3049 

This PR updates widely but this replace is safe as `File::options()` is equivelent to `OpenOptions::new()`.
ref: https://doc.rust-lang.org/stable/src/std/fs.rs.html#378-380
This commit is contained in:
Akihito Nakano
2022-03-07 06:30:18 +00:00
parent cbda0a2f0a
commit 4186d117af
16 changed files with 40 additions and 41 deletions

View File

@@ -6,7 +6,7 @@ use deposit_contract::decode_eth1_tx_data;
use derivative::Derivative;
use eth2_keystore::{Error as KeystoreError, Keystore, PlainText};
use lockfile::{Lockfile, LockfileError};
use std::fs::{read, write, OpenOptions};
use std::fs::{read, write, File};
use std::io;
use std::path::{Path, PathBuf};
use tree_hash::TreeHash;
@@ -211,7 +211,7 @@ pub fn unlock_keypair<P: AsRef<Path>>(
password_dir: P,
) -> Result<Keypair, Error> {
let keystore = Keystore::from_json_reader(
&mut OpenOptions::new()
&mut File::options()
.read(true)
.create(false)
.open(keystore_path)
@@ -236,7 +236,7 @@ pub fn unlock_keypair_from_password_path(
password_path: &Path,
) -> Result<Keypair, Error> {
let keystore = Keystore::from_json_reader(
&mut OpenOptions::new()
&mut File::options()
.read(true)
.create(false)
.open(keystore_path)