Merge branch 'main' of https://github.com/rhaiscript/rhai
This commit is contained in:
parent
2ac6336173
commit
ff6a448b77
@ -156,13 +156,11 @@ impl GlobalRuntimeState<'_> {
|
||||
pub fn find_import(&self, name: &str) -> Option<usize> {
|
||||
let len = self.keys.len();
|
||||
|
||||
self.keys.iter().rev().enumerate().find_map(|(i, key)| {
|
||||
if key == name {
|
||||
Some(len - 1 - i)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
self.keys
|
||||
.iter()
|
||||
.rev()
|
||||
.position(|key| key == name)
|
||||
.map(|i| len - 1 - i)
|
||||
}
|
||||
/// Push an imported [module][crate::Module] onto the stack.
|
||||
///
|
||||
|
@ -720,7 +720,7 @@ fn optimize_stmt(stmt: &mut Stmt, state: &mut OptimizerState, preserve_result: b
|
||||
// Remove all entries after a `true` condition
|
||||
if let Some(n) = list
|
||||
.iter()
|
||||
.find(|&&index| expressions[index].is_always_true())
|
||||
.position(|&index| expressions[index].is_always_true())
|
||||
{
|
||||
if n + 1 < list.len() {
|
||||
state.set_dirty();
|
||||
|
@ -186,7 +186,6 @@ pub enum Union {
|
||||
TimeStamp(Box<Instant>, Tag, AccessMode),
|
||||
|
||||
/// Any type as a trait object.
|
||||
#[allow(clippy::redundant_allocation)]
|
||||
Variant(Box<Box<dyn Variant>>, Tag, AccessMode),
|
||||
|
||||
/// A _shared_ value of any type.
|
||||
|
Loading…
Reference in New Issue
Block a user