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
)
Co-authored-by: François Garillot <4142+huitseeker@users.noreply.github.com>
This commit is contained in:
@@ -267,10 +267,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
|
||||
|
Reference in New Issue
Block a user