From bffe238b16604e0810c22ec1ac70010fe752f873 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 20 Aug 2024 18:33:24 -0500 Subject: [PATCH] simpler --- crates/libs/bindgen/src/rust/classes.rs | 22 ++-------------------- crates/tests/futures/tests/tests.rs | 8 ++++---- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/crates/libs/bindgen/src/rust/classes.rs b/crates/libs/bindgen/src/rust/classes.rs index a809775b80..9d170bdd03 100644 --- a/crates/libs/bindgen/src/rust/classes.rs +++ b/crates/libs/bindgen/src/rust/classes.rs @@ -257,7 +257,7 @@ fn type_is_exclusive(ty: &metadata::Type) -> bool { } fn is_default_async(interfaces: &[metadata::Interface]) -> Option<&metadata::Interface> { - let pos = interfaces.iter().position(|interface| { + interfaces.iter().find(|interface| { if interface.kind == metadata::InterfaceKind::Default { if let metadata::Type::TypeDef(def, _) = interface.ty { if matches!( @@ -272,23 +272,5 @@ fn is_default_async(interfaces: &[metadata::Interface]) -> Option<&metadata::Int } } false - }); - - if let Some(pos) = pos { - if interfaces.len() == 1 { - return interfaces.get(0); - } - - if interfaces.len() == 2 { - let info = if pos == 0 { 1 } else { 0 }; - - if let metadata::Type::TypeDef(def, _) = interfaces[info].ty { - if def.type_name() == metadata::TypeName::IAsyncInfo { - return interfaces.get(pos); - } - } - } - } - - None + }) } diff --git a/crates/tests/futures/tests/tests.rs b/crates/tests/futures/tests/tests.rs index 9e08bde7fb..ac4b30441b 100644 --- a/crates/tests/futures/tests/tests.rs +++ b/crates/tests/futures/tests/tests.rs @@ -45,7 +45,7 @@ fn stream_async() -> Result<()> { fn switch_context() -> Result<()> { use futures::{executor::LocalPool, future, task::SpawnExt}; use std::future::IntoFuture; - + let mut pool = LocalPool::new(); let (sender, receiver) = std::sync::mpsc::channel::<()>(); @@ -65,8 +65,8 @@ fn switch_context() -> Result<()> { } }) .unwrap(); - - let async_future = pool.run_until(select); + + let async_future = pool.run_until(select); pool.spawner() .spawn(async move { @@ -82,4 +82,4 @@ fn switch_context() -> Result<()> { pool.run(); Ok(()) -} \ No newline at end of file +}