Avoid warnings in standard build.
This commit is contained in:
parent
7f1859b6ed
commit
353df6bea1
@ -639,9 +639,7 @@ impl Engine {
|
||||
)
|
||||
.or_else(|err| match *err {
|
||||
// If there is no index setter, no need to set it back because the indexer is read-only
|
||||
EvalAltResult::ErrorFunctionNotFound(s, _)
|
||||
if s == FN_IDX_SET =>
|
||||
{
|
||||
EvalAltResult::ErrorFunctionNotFound(_, _) => {
|
||||
Ok(Default::default())
|
||||
}
|
||||
_ => Err(err),
|
||||
|
@ -864,10 +864,22 @@ impl Engine {
|
||||
EvalAltResult::ErrorFunctionNotFound(_, _) if def_val.is_some() => {
|
||||
Ok(def_val.unwrap().into())
|
||||
}
|
||||
EvalAltResult::ErrorFunctionNotFound(_, _) => {
|
||||
EvalAltResult::ErrorFunctionNotFound(_, pos) => {
|
||||
Err(Box::new(EvalAltResult::ErrorFunctionNotFound(
|
||||
format!("{}{}", modules, name),
|
||||
Position::none(),
|
||||
format!(
|
||||
"{}{} ({})",
|
||||
modules,
|
||||
name,
|
||||
args.iter()
|
||||
.map(|a| if a.is::<ImmutableString>() {
|
||||
"&str | ImmutableString | String"
|
||||
} else {
|
||||
self.map_type_name((*a).type_name())
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
),
|
||||
pos,
|
||||
)))
|
||||
}
|
||||
_ => Err(err),
|
||||
|
@ -9,9 +9,12 @@ use crate::token::{is_valid_identifier, Position};
|
||||
use crate::utils::{ImmutableString, StaticVec};
|
||||
use crate::Scope;
|
||||
|
||||
use crate::stdlib::{
|
||||
boxed::Box, convert::TryFrom, fmt, mem, rc::Rc, string::String, sync::Arc, vec::Vec,
|
||||
};
|
||||
use crate::stdlib::{boxed::Box, convert::TryFrom, fmt, mem, string::String, vec::Vec};
|
||||
|
||||
#[cfg(not(feature = "sync"))]
|
||||
use crate::stdlib::rc::Rc;
|
||||
#[cfg(feature = "sync")]
|
||||
use crate::stdlib::sync::Arc;
|
||||
|
||||
/// Trait that maps to `Send + Sync` only under the `sync` feature.
|
||||
#[cfg(feature = "sync")]
|
||||
|
@ -20,9 +20,12 @@ use crate::stdlib::{
|
||||
boxed::Box,
|
||||
fmt::Display,
|
||||
format,
|
||||
ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Shl, Shr, Sub},
|
||||
ops::{Add, BitAnd, BitOr, BitXor, Div, Mul, Neg, Rem, Sub},
|
||||
};
|
||||
|
||||
#[cfg(feature = "unchecked")]
|
||||
use crate::stdlib::ops::{Shl, Shr};
|
||||
|
||||
// Checked add
|
||||
pub(crate) fn add<T: Display + CheckedAdd>(x: T, y: T) -> FuncReturn<T> {
|
||||
x.checked_add(&y).ok_or_else(|| {
|
||||
@ -171,10 +174,12 @@ pub(crate) fn shr<T: Display + CheckedShr>(x: T, y: INT) -> FuncReturn<T> {
|
||||
})
|
||||
}
|
||||
// Unchecked left-shift - may panic if shifting by a negative number of bits
|
||||
#[cfg(feature = "unchecked")]
|
||||
pub(crate) fn shl_u<T: Shl<T>>(x: T, y: T) -> FuncReturn<<T as Shl<T>>::Output> {
|
||||
Ok(x.shl(y))
|
||||
}
|
||||
// Unchecked right-shift - may panic if shifting by a negative number of bits
|
||||
#[cfg(feature = "unchecked")]
|
||||
pub(crate) fn shr_u<T: Shr<T>>(x: T, y: T) -> FuncReturn<<T as Shr<T>>::Output> {
|
||||
Ok(x.shr(y))
|
||||
}
|
||||
@ -229,6 +234,7 @@ pub(crate) fn pow_i_i(x: INT, y: INT) -> FuncReturn<INT> {
|
||||
}
|
||||
}
|
||||
// Unchecked integer power - may panic on overflow or if the power index is too high (> u32::MAX)
|
||||
#[cfg(feature = "unchecked")]
|
||||
pub(crate) fn pow_i_i_u(x: INT, y: INT) -> FuncReturn<INT> {
|
||||
Ok(x.pow(y as u32))
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ impl PackagesCollection {
|
||||
.flatten()
|
||||
}
|
||||
/// Does the specified TypeId iterator exist in the `PackagesCollection`?
|
||||
#[allow(dead_code)]
|
||||
pub fn contains_iter(&self, id: TypeId) -> bool {
|
||||
self.0.iter().any(|p| p.contains_iter(id))
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
#![cfg(not(feature = "no_std"))]
|
||||
use super::logic::{eq, gt, gte, lt, lte, ne};
|
||||
|
||||
#[cfg(feature = "no_float")]
|
||||
use super::math_basic::MAX_INT;
|
||||
|
||||
use crate::def_package;
|
||||
use crate::module::FuncReturn;
|
||||
use crate::parser::INT;
|
||||
use crate::result::EvalAltResult;
|
||||
use crate::token::Position;
|
||||
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
use crate::parser::FLOAT;
|
||||
|
||||
#[cfg(feature = "no_float")]
|
||||
use crate::{module::FuncReturn, parser::INT, token::Position};
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use crate::stdlib::time::Instant;
|
||||
@ -14,9 +19,6 @@ use crate::stdlib::time::Instant;
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use instant::Instant;
|
||||
|
||||
#[cfg(not(feature = "no_float"))]
|
||||
use crate::parser::FLOAT;
|
||||
|
||||
def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
|
||||
// Register date/time functions
|
||||
lib.set_fn_0("timestamp", || Ok(Instant::now()));
|
||||
|
@ -14,11 +14,14 @@ use crate::utils::StaticVec;
|
||||
use crate::stdlib::{
|
||||
boxed::Box,
|
||||
fmt, format,
|
||||
rc::Rc,
|
||||
string::{String, ToString},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "sync"))]
|
||||
use crate::stdlib::rc::Rc;
|
||||
#[cfg(feature = "sync")]
|
||||
use crate::stdlib::sync::Arc;
|
||||
|
||||
/// A general expression evaluation trait object.
|
||||
#[cfg(not(feature = "sync"))]
|
||||
pub type FnCustomSyntaxEval = dyn Fn(
|
||||
|
Loading…
Reference in New Issue
Block a user