Fix compiling for all features.
This commit is contained in:
parent
d3a97dc86b
commit
6351c07bc6
@ -12,12 +12,10 @@ use crate::stdlib::{
|
||||
};
|
||||
|
||||
fn map_get_keys(map: &mut Map) -> Vec<Dynamic> {
|
||||
map.iter()
|
||||
.map(|(k, _)| k.to_string().into())
|
||||
.collect::<Vec<_>>()
|
||||
map.iter().map(|(k, _)| k.to_string().into()).collect()
|
||||
}
|
||||
fn map_get_values(map: &mut Map) -> Vec<Dynamic> {
|
||||
map.iter().map(|(_, v)| v.clone()).collect::<Vec<_>>()
|
||||
map.iter().map(|(_, v)| v.clone()).collect()
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "no_object"))]
|
||||
|
@ -37,7 +37,7 @@ fn sub_string(s: &mut String, start: INT, len: INT) -> String {
|
||||
len as usize
|
||||
};
|
||||
|
||||
chars[offset..][..len].into_iter().collect::<String>()
|
||||
chars[offset..][..len].into_iter().collect()
|
||||
}
|
||||
fn crop_string(s: &mut String, start: INT, len: INT) {
|
||||
let offset = if s.is_empty() || len <= 0 {
|
||||
|
@ -87,10 +87,10 @@ def_package!(crate:BasicTimePackage:"Basic timing utilities.", lib, {
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
{
|
||||
if seconds > (MAX_INT as u64) {
|
||||
return Err(EvalAltResult::ErrorArithmetic(
|
||||
return Err(Box::new(EvalAltResult::ErrorArithmetic(
|
||||
format!("Integer overflow for timestamp.elapsed(): {}", seconds),
|
||||
Position::none(),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
return Ok(seconds as INT);
|
||||
|
@ -4,7 +4,7 @@ use crate::any::{Dynamic, Variant};
|
||||
use crate::parser::{map_dynamic_to_expr, Expr};
|
||||
use crate::token::Position;
|
||||
|
||||
use crate::stdlib::{borrow::Cow, iter, vec::Vec};
|
||||
use crate::stdlib::{borrow::Cow, boxed::Box, iter, vec::Vec};
|
||||
|
||||
/// Type of an entry in the Scope.
|
||||
#[derive(Debug, Eq, PartialEq, Hash, Copy, Clone)]
|
||||
@ -362,7 +362,7 @@ impl<'a> Scope<'a> {
|
||||
}
|
||||
|
||||
/// Get an iterator to entries in the Scope.
|
||||
pub fn iter(&self) -> impl Iterator<Item = &Entry> {
|
||||
pub(crate) fn iter(&self) -> impl Iterator<Item = &Entry> {
|
||||
self.0.iter().rev() // Always search a Scope in reverse order
|
||||
}
|
||||
}
|
||||
|
@ -143,6 +143,7 @@ fn test_map_return() -> Result<(), Box<EvalAltResult>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(feature = "no_index"))]
|
||||
fn test_map_for() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user