Fix some nightly warnings (#5093)
ONCE_INIT => Once::new Box<Error> => Box<dyn Error>
This commit is contained in:
@ -69,7 +69,7 @@ impl fmt::Display for Pubkey {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn write_pubkey(outfile: &str, pubkey: Pubkey) -> Result<(), Box<error::Error>> {
|
||||
pub fn write_pubkey(outfile: &str, pubkey: Pubkey) -> Result<(), Box<dyn error::Error>> {
|
||||
let printable = format!("{}", pubkey);
|
||||
let serialized = serde_json::to_string(&printable)?;
|
||||
|
||||
@ -82,7 +82,7 @@ pub fn write_pubkey(outfile: &str, pubkey: Pubkey) -> Result<(), Box<error::Erro
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn read_pubkey(infile: &str) -> Result<Pubkey, Box<error::Error>> {
|
||||
pub fn read_pubkey(infile: &str) -> Result<Pubkey, Box<dyn error::Error>> {
|
||||
let f = File::open(infile.to_string())?;
|
||||
let printable: String = serde_json::from_reader(f)?;
|
||||
Ok(Pubkey::from_str(&printable)?)
|
||||
@ -166,7 +166,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_write_pubkey() -> Result<(), Box<error::Error>> {
|
||||
fn test_read_write_pubkey() -> Result<(), Box<dyn error::Error>> {
|
||||
let filename = "test_pubkey.json";
|
||||
let pubkey = Pubkey::new_rand();
|
||||
write_pubkey(filename, pubkey)?;
|
||||
|
@ -118,7 +118,7 @@ impl KeypairUtil for Keypair {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_keypair(path: &str) -> Result<Keypair, Box<error::Error>> {
|
||||
pub fn read_keypair(path: &str) -> Result<Keypair, Box<dyn error::Error>> {
|
||||
let file = File::open(path.to_string())?;
|
||||
let bytes: Vec<u8> = serde_json::from_reader(file)?;
|
||||
let keypair = Keypair::from_bytes(&bytes)
|
||||
@ -126,7 +126,7 @@ pub fn read_keypair(path: &str) -> Result<Keypair, Box<error::Error>> {
|
||||
Ok(keypair)
|
||||
}
|
||||
|
||||
pub fn gen_keypair_file(outfile: &str) -> Result<String, Box<error::Error>> {
|
||||
pub fn gen_keypair_file(outfile: &str) -> Result<String, Box<dyn error::Error>> {
|
||||
let keypair_bytes = Keypair::new().to_bytes();
|
||||
let serialized = serde_json::to_string(&keypair_bytes.to_vec())?;
|
||||
|
||||
|
Reference in New Issue
Block a user