Small code refinements.
This commit is contained in:
parent
202285f9ab
commit
4f14fd55f5
12
src/ast.rs
12
src/ast.rs
@ -2120,10 +2120,14 @@ mod tests {
|
||||
assert_eq!(size_of::<Option<ast::Expr>>(), 16);
|
||||
assert_eq!(size_of::<ast::Stmt>(), 32);
|
||||
assert_eq!(size_of::<Option<ast::Stmt>>(), 32);
|
||||
#[cfg(not(feature = "no_smartstring"))]
|
||||
assert_eq!(size_of::<FnPtr>(), 96);
|
||||
#[cfg(feature = "no_smartstring")]
|
||||
assert_eq!(size_of::<FnPtr>(), 80);
|
||||
assert_eq!(
|
||||
size_of::<FnPtr>(),
|
||||
if cfg!(feature = "no_smartstring") {
|
||||
80
|
||||
} else {
|
||||
96
|
||||
}
|
||||
);
|
||||
assert_eq!(size_of::<Scope>(), 288);
|
||||
assert_eq!(size_of::<LexError>(), 56);
|
||||
assert_eq!(
|
||||
|
@ -321,7 +321,7 @@ mod decimal_functions {
|
||||
#[rhai_fn(return_raw)]
|
||||
pub fn exp(x: Decimal) -> Result<Decimal, Box<EvalAltResult>> {
|
||||
if cfg!(not(feature = "unchecked")) {
|
||||
if x > Decimal::from_parts(10, 0, 0, false, 0) {
|
||||
if x > Decimal::from_parts(117578, 0, 0, false, 4) {
|
||||
Err(make_err(format!("Exponential overflow: e ** {}", x,)))
|
||||
} else {
|
||||
Ok(x.exp())
|
||||
|
Loading…
Reference in New Issue
Block a user