Fix builds.

This commit is contained in:
Stephen Chung 2021-08-13 14:04:27 +08:00
parent dba4510456
commit 0f46bc7725
2 changed files with 4 additions and 4 deletions

View File

@ -429,7 +429,7 @@ mod decimal_functions {
#[rhai_fn(return_raw)] #[rhai_fn(return_raw)]
pub fn parse_decimal(string: &str) -> Result<Decimal, Box<EvalAltResult>> { pub fn parse_decimal(string: &str) -> Result<Decimal, Box<EvalAltResult>> {
Decimal::from_str(string) Decimal::from_str(string)
.or_else(|_| Decimal::from_scientific(s)) .or_else(|_| Decimal::from_scientific(string))
.map_err(|err| { .map_err(|err| {
EvalAltResult::ErrorArithmetic( EvalAltResult::ErrorArithmetic(
format!("Error parsing decimal number '{}': {}", string, err), format!("Error parsing decimal number '{}': {}", string, err),

View File

@ -66,8 +66,8 @@ mod time_functions {
.into()); .into());
#[cfg(feature = "no_float")] #[cfg(feature = "no_float")]
if timestamp2 > timestamp { if timestamp2 > timestamp1 {
let seconds = (timestamp2 - timestamp).as_secs(); let seconds = (timestamp2 - timestamp1).as_secs();
if cfg!(not(feature = "unchecked")) && seconds > (MAX_INT as u64) { if cfg!(not(feature = "unchecked")) && seconds > (MAX_INT as u64) {
Err(make_arithmetic_err(format!( Err(make_arithmetic_err(format!(
@ -78,7 +78,7 @@ mod time_functions {
Ok((-(seconds as INT)).into()) Ok((-(seconds as INT)).into())
} }
} else { } else {
let seconds = (timestamp - timestamp2).as_secs(); let seconds = (timestamp1 - timestamp2).as_secs();
if cfg!(not(feature = "unchecked")) && seconds > (MAX_INT as u64) { if cfg!(not(feature = "unchecked")) && seconds > (MAX_INT as u64) {
Err(make_arithmetic_err(format!( Err(make_arithmetic_err(format!(