mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
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:
@@ -2,7 +2,7 @@
|
||||
|
||||
use eth2_wallet::Error as WalletError;
|
||||
use eth2_wallet::{Uuid, Wallet};
|
||||
use std::fs::{copy as copy_file, remove_file, OpenOptions};
|
||||
use std::fs::{copy as copy_file, remove_file, File};
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -27,7 +27,7 @@ pub fn read<P: AsRef<Path>>(wallet_dir: P, uuid: &Uuid) -> Result<Wallet, Error>
|
||||
if !json_path.exists() {
|
||||
Err(Error::WalletDoesNotExist(json_path))
|
||||
} else {
|
||||
OpenOptions::new()
|
||||
File::options()
|
||||
.read(true)
|
||||
.create(false)
|
||||
.open(json_path)
|
||||
@@ -79,7 +79,7 @@ pub fn create<P: AsRef<Path>>(wallet_dir: P, wallet: &Wallet) -> Result<(), Erro
|
||||
if json_path.exists() {
|
||||
Err(Error::WalletAlreadyExists(json_path))
|
||||
} else {
|
||||
OpenOptions::new()
|
||||
File::options()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(json_path)
|
||||
|
||||
Reference in New Issue
Block a user