[object Object]

← back to Exo

util: remove VecExt trait, inline at call site (#1446)

199df64cfc940d580cdc75639f0675bc776bdb3e · 2026-02-10 20:45:57 +0000 · Jake Hillion

VecExt added a .map() convenience method on Vec<T> 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

Files touched

Diff

commit 199df64cfc940d580cdc75639f0675bc776bdb3e
Author: Jake Hillion <jake@hillion.co.uk>
Date:   Tue Feb 10 20:45:57 2026 +0000

    util: remove VecExt trait, inline at call site (#1446)
    
    VecExt added a .map() convenience method on Vec<T> 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 2d99a724..a45bfe9d 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 e2f88f2b..01024cf9 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 7c383046..bf820ed2 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 bde31178..b39d15f6 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<T> Vec<T> {
-        #[inline]
-        fn map<B, F>(self, f: F) -> Vec<B>
-        where
-            F: FnMut(T) -> B,
-        {
-            self.into_iter().map(f).collect()
-        }
-    }
-}

← dc7ade80 set the mlx hash  ·  back to Exo  ·  Fix setrlimit crash when hard file descriptor limit < 65535 eead50b4 →