[easy, cleanup] Simplify some pattern-matches (bp #16402) (#16445)

* Simplify some pattern-matches (#16402)

When those match an exact combinator on Option / Result.

Tool-aided by [comby-rust](https://github.com/huitseeker/comby-rust).

(cherry picked from commit b08cff9e77)

# Conflicts:
#	accounts-cluster-bench/src/main.rs
#	core/src/rpc.rs
#	runtime/src/accounts_hash.rs
#	runtime/src/message_processor.rs

* Fix conflicts

Co-authored-by: François Garillot <4142+huitseeker@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
mergify[bot]
2021-04-08 20:01:20 +00:00
committed by GitHub
parent f10f57e89f
commit 11ab894256
16 changed files with 58 additions and 104 deletions

View File

@@ -241,10 +241,7 @@ impl Instruction {
}
pub fn checked_add(a: u64, b: u64) -> Result<u64, InstructionError> {
match a.checked_add(b) {
Some(sum) => Ok(sum),
None => Err(InstructionError::InsufficientFunds),
}
a.checked_add(b).ok_or(InstructionError::InsufficientFunds)
}
/// Account metadata used to define Instructions