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).
This commit is contained in:
François Garillot
2021-04-08 14:40:37 -04:00
committed by GitHub
parent bb9d2fd07a
commit b08cff9e77
18 changed files with 60 additions and 110 deletions

View File

@ -272,10 +272,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