From d25e19988b7436c32e870cd853cb3a7e9e6d030d Mon Sep 17 00:00:00 2001 From: Lyndon Date: Thu, 5 Dec 2024 16:21:30 +0800 Subject: [PATCH] fix: make it short on checked_add --- src/transcendental.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/transcendental.rs b/src/transcendental.rs index 668fac6..114ff9f 100644 --- a/src/transcendental.rs +++ b/src/transcendental.rs @@ -244,11 +244,7 @@ where }; let operand = D::from(operand); - let mut result = if let Some(r) = operand.checked_add(D::from_num(1)) { - r - } else { - return Err(()); - }; + let mut result = operand.checked_add(D::from_num(1)).ok_or(())?; let mut term = operand; for i in 2..D::frac_nbits() {