Use iterators.
This commit is contained in:
@@ -1244,14 +1244,14 @@ impl Engine {
|
||||
if !has_condition && ranges.is_empty() && r.len() <= SMALL_SWITCH_RANGE
|
||||
{
|
||||
// Unroll small range
|
||||
for n in r {
|
||||
r.into_iter().for_each(|n| {
|
||||
let hasher = &mut get_hasher();
|
||||
Dynamic::from_int(n).hash(hasher);
|
||||
cases
|
||||
.entry(hasher.finish())
|
||||
.and_modify(|cases| cases.push(index))
|
||||
.or_insert_with(|| [index].into());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Other range
|
||||
r.set_index(index);
|
||||
@@ -3983,9 +3983,9 @@ impl Engine {
|
||||
{
|
||||
let mut m = crate::Module::new();
|
||||
|
||||
for fn_def in _lib {
|
||||
_lib.into_iter().for_each(|fn_def| {
|
||||
m.set_script_fn(fn_def);
|
||||
}
|
||||
});
|
||||
|
||||
return Ok(AST::new(statements, m));
|
||||
}
|
||||
|
Reference in New Issue
Block a user