Update to rust 1.40.0 (#7572)

* Update to rust 1.40.0

* fixups
This commit is contained in:
Rob Walker
2019-12-19 23:27:54 -08:00
committed by GitHub
parent 2ebfab8e07
commit a7040896f0
33 changed files with 198 additions and 139 deletions

View File

@ -802,11 +802,11 @@ fn process_deploy(
) -> ProcessResult {
let program_id = Keypair::new();
let mut file = File::open(program_location).map_err(|err| {
CliError::DynamicProgramError(format!("Unable to open program file: {}", err).to_string())
CliError::DynamicProgramError(format!("Unable to open program file: {}", err))
})?;
let mut program_data = Vec::new();
file.read_to_end(&mut program_data).map_err(|err| {
CliError::DynamicProgramError(format!("Unable to read program file: {}", err).to_string())
CliError::DynamicProgramError(format!("Unable to read program file: {}", err))
})?;
// Build transactions to calculate fees

View File

@ -357,9 +357,10 @@ pub fn process_create_nonce_account(
pub fn process_get_nonce(rpc_client: &RpcClient, nonce_account_pubkey: &Pubkey) -> ProcessResult {
let nonce_account = rpc_client.get_account(nonce_account_pubkey)?;
if nonce_account.owner != nonce_program::id() {
return Err(CliError::RpcRequestError(
format!("{:?} is not a nonce account", nonce_account_pubkey).to_string(),
)
return Err(CliError::RpcRequestError(format!(
"{:?} is not a nonce account",
nonce_account_pubkey
))
.into());
}
match nonce_account.state() {
@ -417,9 +418,10 @@ pub fn process_show_nonce_account(
) -> ProcessResult {
let nonce_account = rpc_client.get_account(nonce_account_pubkey)?;
if nonce_account.owner != nonce_program::id() {
return Err(CliError::RpcRequestError(
format!("{:?} is not a nonce account", nonce_account_pubkey).to_string(),
)
return Err(CliError::RpcRequestError(format!(
"{:?} is not a nonce account",
nonce_account_pubkey
))
.into());
}
let print_account = |hash: Option<Hash>| {

View File

@ -658,9 +658,10 @@ pub fn process_show_stake_account(
) -> ProcessResult {
let stake_account = rpc_client.get_account(stake_account_pubkey)?;
if stake_account.owner != solana_stake_program::id() {
return Err(CliError::RpcRequestError(
format!("{:?} is not a stake account", stake_account_pubkey).to_string(),
)
return Err(CliError::RpcRequestError(format!(
"{:?} is not a stake account",
stake_account_pubkey
))
.into());
}
fn show_authorized(authorized: &Authorized) {

View File

@ -214,7 +214,7 @@ pub fn process_claim_storage_reward(
&tx.message,
)?;
let signature_str = rpc_client.send_and_confirm_transaction(&mut tx, &signers)?;
Ok(signature_str.to_string())
Ok(signature_str)
}
pub fn process_show_storage_account(
@ -225,17 +225,16 @@ pub fn process_show_storage_account(
let account = rpc_client.get_account(storage_account_pubkey)?;
if account.owner != solana_storage_program::id() {
return Err(CliError::RpcRequestError(
format!("{:?} is not a storage account", storage_account_pubkey).to_string(),
)
return Err(CliError::RpcRequestError(format!(
"{:?} is not a storage account",
storage_account_pubkey
))
.into());
}
use solana_storage_program::storage_contract::StorageContract;
let storage_contract: StorageContract = account.state().map_err(|err| {
CliError::RpcRequestError(
format!("Unable to deserialize storage account: {:?}", err).to_string(),
)
CliError::RpcRequestError(format!("Unable to deserialize storage account: {:?}", err))
})?;
println!("{:#?}", storage_contract);
println!("account lamports: {}", account.lamports);

View File

@ -402,9 +402,10 @@ fn get_vote_account(
let vote_account = rpc_client.get_account(vote_account_pubkey)?;
if vote_account.owner != solana_vote_program::id() {
return Err(CliError::RpcRequestError(
format!("{:?} is not a vote account", vote_account_pubkey).to_string(),
)
return Err(CliError::RpcRequestError(format!(
"{:?} is not a vote account",
vote_account_pubkey
))
.into());
}
let vote_state = VoteState::deserialize(&vote_account.data).map_err(|_| {