From 199df64cfc940d580cdc75639f0675bc776bdb3e Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Tue, 10 Feb 2026 20:45:57 +0000 Subject: [PATCH] util: remove VecExt trait, inline at call site (#1446) VecExt added a .map() convenience method on Vec that simply called .into_iter().map(f).collect(). This thin wrapper provided no optimisation benefit and obscured a standard iterator pattern behind a nightly feature gate and an extra dependency. Replaced the single call site in exo_pyo3_bindings with the equivalent iterator chain and removed the ext module, the extend dependency, and the trait_alias feature gate from the util crate. Test plan: - CI --- Cargo.lock | 3 --- rust/exo_pyo3_bindings/src/networking.rs | 5 +++-- rust/util/Cargo.toml | 1 - rust/util/src/lib.rs | 19 ------------------- 4 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d99a724a..a45bfe9dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4716,9 +4716,6 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "util" version = "0.0.1" -dependencies = [ - "extend", -] [[package]] name = "uuid" diff --git a/rust/exo_pyo3_bindings/src/networking.rs b/rust/exo_pyo3_bindings/src/networking.rs index e2f88f2bc..01024cf90 100644 --- a/rust/exo_pyo3_bindings/src/networking.rs +++ b/rust/exo_pyo3_bindings/src/networking.rs @@ -22,7 +22,6 @@ use pyo3::{Bound, Py, PyErr, PyResult, PyTraverseError, PyVisit, Python, pymetho use pyo3_stub_gen::derive::{gen_stub_pyclass, gen_stub_pyclass_enum, gen_stub_pymethods}; use std::net::IpAddr; use tokio::sync::{Mutex, mpsc, oneshot}; -use util::ext::VecExt as _; mod exception { use pyo3::types::PyTuple; @@ -532,7 +531,9 @@ impl PyNetworkingHandle { .recv_many_py(limit) .allow_threads_py() // allow-threads-aware async call .await? - .map(|(t, d)| (t, d.pybytes()))) + .into_iter() + .map(|(t, d)| (t, d.pybytes())) + .collect()) } // TODO: rn this blocks main thread if anything else is awaiting the channel (bc its a mutex) diff --git a/rust/util/Cargo.toml b/rust/util/Cargo.toml index 7c383046e..bf820ed2f 100644 --- a/rust/util/Cargo.toml +++ b/rust/util/Cargo.toml @@ -13,4 +13,3 @@ path = "src/lib.rs" workspace = true [dependencies] -extend = { workspace = true } diff --git a/rust/util/src/lib.rs b/rust/util/src/lib.rs index bde311785..b39d15f6b 100644 --- a/rust/util/src/lib.rs +++ b/rust/util/src/lib.rs @@ -1,20 +1 @@ -// enable Rust-unstable features for convenience -#![feature(trait_alias)] - pub mod wakerdeque; - -/// Namespace for crate-wide extension traits/methods -pub mod ext { - use extend::ext; - - #[ext(pub, name = VecExt)] - impl Vec { - #[inline] - fn map(self, f: F) -> Vec - where - F: FnMut(T) -> B, - { - self.into_iter().map(f).collect() - } - } -}