This commit is contained in:
Stephen Chung 2022-07-20 21:06:36 +08:00
parent 2ac6336173
commit ff6a448b77
3 changed files with 6 additions and 9 deletions

View File

@ -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.
///

View File

@ -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();

View File

@ -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.