← back to Exo
util: remove dead code (#1445)
c37eb24331ff8fd530a8b8718776369b58e4b243 · 2026-02-10 20:10:54 +0000 · Jake Hillion
The util crate contained several unused items: NonemptyArray,
BoxedSliceExt, a blanket Sealed trait, an empty alias module, six unused
nightly feature gates, and five unused Cargo dependencies (thiserror,
once_cell, internment, derive_more, bon, recursion).
Removed all items that had no references outside their own definitions,
keeping only WakerDeque, VecExt, and the trait_alias feature gate which
are actively used by the networking and exo_pyo3_bindings crates.
Test plan:
- CI
Files touched
M Cargo.lockM rust/util/Cargo.tomlM rust/util/src/lib.rsD rust/util/src/nonempty.rs
Diff
commit c37eb24331ff8fd530a8b8718776369b58e4b243
Author: Jake Hillion <jake@hillion.co.uk>
Date: Tue Feb 10 20:10:54 2026 +0000
util: remove dead code (#1445)
The util crate contained several unused items: NonemptyArray,
BoxedSliceExt, a blanket Sealed trait, an empty alias module, six unused
nightly feature gates, and five unused Cargo dependencies (thiserror,
once_cell, internment, derive_more, bon, recursion).
Removed all items that had no references outside their own definitions,
keeping only WakerDeque, VecExt, and the trait_alias feature gate which
are actively used by the networking and exo_pyo3_bindings crates.
Test plan:
- CI
---
Cargo.lock | 97 --------------------------------
rust/util/Cargo.toml | 9 ---
rust/util/src/lib.rs | 33 -----------
rust/util/src/nonempty.rs | 138 ----------------------------------------------
4 files changed, 277 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 301ee935..2d99a724 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -353,31 +353,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "bon"
-version = "3.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ebeb9aaf9329dff6ceb65c689ca3db33dbf15f324909c60e4e5eef5701ce31b1"
-dependencies = [
- "bon-macros",
- "rustversion",
-]
-
-[[package]]
-name = "bon-macros"
-version = "3.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77e9d642a7e3a318e37c2c9427b5a6a48aa1ad55dcd986f3034ab2239045a645"
-dependencies = [
- "darling",
- "ident_case",
- "prettyplease",
- "proc-macro2",
- "quote",
- "rustversion",
- "syn 2.0.111",
-]
-
[[package]]
name = "bs58"
version = "0.5.1"
@@ -700,41 +675,6 @@ dependencies = [
"syn 2.0.111",
]
-[[package]]
-name = "darling"
-version = "0.21.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
-dependencies = [
- "darling_core",
- "darling_macro",
-]
-
-[[package]]
-name = "darling_core"
-version = "0.21.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4"
-dependencies = [
- "fnv",
- "ident_case",
- "proc-macro2",
- "quote",
- "strsim",
- "syn 2.0.111",
-]
-
-[[package]]
-name = "darling_macro"
-version = "0.21.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
-dependencies = [
- "darling_core",
- "quote",
- "syn 2.0.111",
-]
-
[[package]]
name = "data-encoding"
version = "2.9.0"
@@ -1625,12 +1565,6 @@ dependencies = [
"zerovec",
]
-[[package]]
-name = "ident_case"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
-
[[package]]
name = "idna"
version = "1.1.0"
@@ -1745,15 +1679,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "internment"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "636d4b0f6a39fd684effe2a73f5310df16a3fa7954c26d36833e98f44d1977a2"
-dependencies = [
- "hashbrown 0.15.5",
-]
-
[[package]]
name = "inventory"
version = "0.3.21"
@@ -3307,16 +3232,6 @@ dependencies = [
"zerocopy",
]
-[[package]]
-name = "prettyplease"
-version = "0.2.37"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
-dependencies = [
- "proc-macro2",
- "syn 2.0.111",
-]
-
[[package]]
name = "primeorder"
version = "0.13.6"
@@ -3740,12 +3655,6 @@ dependencies = [
"yasna",
]
-[[package]]
-name = "recursion"
-version = "0.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9dba2197bf7b1d87b4dd460c195f4edeb45a94e82e8054f8d5f317c1f0e93ca1"
-
[[package]]
name = "redox_syscall"
version = "0.5.18"
@@ -4808,13 +4717,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
name = "util"
version = "0.0.1"
dependencies = [
- "bon",
- "derive_more",
"extend",
- "internment",
- "once_cell",
- "recursion",
- "thiserror 2.0.17",
]
[[package]]
diff --git a/rust/util/Cargo.toml b/rust/util/Cargo.toml
index aeae3534..7c383046 100644
--- a/rust/util/Cargo.toml
+++ b/rust/util/Cargo.toml
@@ -13,13 +13,4 @@ path = "src/lib.rs"
workspace = true
[dependencies]
-# macro dependencies
extend = { workspace = true }
-
-# utility dependencies
-thiserror = { workspace = true }
-once_cell = { workspace = true }
-internment = { workspace = true }
-derive_more = { workspace = true }
-bon = { workspace = true }
-recursion = { workspace = true }
diff --git a/rust/util/src/lib.rs b/rust/util/src/lib.rs
index 60e11f3a..bde31178 100644
--- a/rust/util/src/lib.rs
+++ b/rust/util/src/lib.rs
@@ -1,45 +1,12 @@
-//! TODO: crate documentation
-//!
-//! this is here as a placeholder documentation
-//!
-//!
-
// enable Rust-unstable features for convenience
#![feature(trait_alias)]
-#![feature(stmt_expr_attributes)]
-#![feature(type_alias_impl_trait)]
-#![feature(specialization)]
-#![feature(unboxed_closures)]
-#![feature(const_trait_impl)]
-#![feature(fn_traits)]
-pub mod nonempty;
pub mod wakerdeque;
-pub(crate) mod private {
- // sealed traits support
- pub trait Sealed {}
- impl<T: ?Sized> Sealed for T {}
-}
-
-/// Namespace for all the type/trait aliases used by this crate.
-pub(crate) mod alias {}
-
/// Namespace for crate-wide extension traits/methods
pub mod ext {
use extend::ext;
- #[ext(pub, name = BoxedSliceExt)]
- impl<T> Box<[T]> {
- #[inline]
- fn map<B, F>(self, f: F) -> Box<[B]>
- where
- F: FnMut(T) -> B,
- {
- self.into_iter().map(f).collect()
- }
- }
-
#[ext(pub, name = VecExt)]
impl<T> Vec<T> {
#[inline]
diff --git a/rust/util/src/nonempty.rs b/rust/util/src/nonempty.rs
deleted file mode 100644
index e9eb8620..00000000
--- a/rust/util/src/nonempty.rs
+++ /dev/null
@@ -1,138 +0,0 @@
-use std::slice::SliceIndex;
-use std::{ops, slice};
-use thiserror::Error;
-
-#[derive(Error, Debug)]
-#[error("Cannot create to `NonemptyArray` because the supplied slice is empty")]
-pub struct EmptySliceError;
-
-/// A pointer to a non-empty fixed-size slice allocated on the heap.
-#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
-#[repr(transparent)]
-pub struct NonemptyArray<T>(Box<[T]>);
-
-#[allow(clippy::arbitrary_source_item_ordering)]
-impl<T> NonemptyArray<T> {
- #[inline]
- pub fn singleton(value: T) -> Self {
- Self(Box::new([value]))
- }
-
- #[allow(clippy::missing_errors_doc)]
- #[inline]
- pub fn try_from_boxed_slice<S: Into<Box<[T]>>>(
- boxed_slice: S,
- ) -> Result<Self, EmptySliceError> {
- let boxed_slice = boxed_slice.into();
- if boxed_slice.is_empty() {
- Err(EmptySliceError)
- } else {
- Ok(Self(boxed_slice))
- }
- }
-
- #[must_use]
- #[inline]
- pub fn into_boxed_slice(self) -> Box<[T]> {
- self.0
- }
-
- #[must_use]
- #[inline]
- pub fn to_vec(&self) -> Vec<T>
- where
- T: Clone,
- {
- self.0.to_vec()
- }
-
- #[must_use]
- #[inline]
- pub const fn as_slice(&self) -> &[T] {
- &self.0
- }
-
- #[allow(clippy::indexing_slicing)]
- #[must_use]
- #[inline]
- pub fn first(&self) -> &T {
- &self.0[0]
- }
-
- #[allow(clippy::indexing_slicing, clippy::arithmetic_side_effects)]
- #[must_use]
- #[inline]
- pub fn last(&self) -> &T {
- &self.0[self.0.len() - 1]
- }
-
- #[must_use]
- #[inline]
- pub fn get<I>(&self, index: I) -> Option<&I::Output>
- where
- I: SliceIndex<[T]>,
- {
- self.0.get(index)
- }
-
- #[allow(clippy::len_without_is_empty)]
- #[must_use]
- #[inline]
- pub const fn len(&self) -> usize {
- self.0.len()
- }
-
- #[allow(clippy::iter_without_into_iter)]
- #[inline]
- pub fn iter(&self) -> slice::Iter<'_, T> {
- self.0.iter()
- }
-
- #[allow(clippy::iter_without_into_iter)]
- #[inline]
- pub fn iter_mut(&mut self) -> slice::IterMut<'_, T> {
- self.0.iter_mut()
- }
-
- #[inline]
- #[must_use]
- pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> NonemptyArray<U> {
- NonemptyArray(self.0.into_iter().map(f).collect())
- }
-}
-
-impl<T> From<NonemptyArray<T>> for Box<[T]> {
- #[inline]
- fn from(value: NonemptyArray<T>) -> Self {
- value.into_boxed_slice()
- }
-}
-
-impl<T> ops::Index<usize> for NonemptyArray<T> {
- type Output = T;
-
- #[inline]
- fn index(&self, index: usize) -> &Self::Output {
- self.0.index(index)
- }
-}
-
-impl<T> IntoIterator for NonemptyArray<T> {
- type Item = T;
- type IntoIter = std::vec::IntoIter<T>;
-
- #[inline]
- fn into_iter(self) -> Self::IntoIter {
- self.into_boxed_slice().into_vec().into_iter()
- }
-}
-
-impl<'a, T> IntoIterator for &'a NonemptyArray<T> {
- type Item = &'a T;
- type IntoIter = slice::Iter<'a, T>;
-
- #[inline]
- fn into_iter(self) -> Self::IntoIter {
- self.iter()
- }
-}
← 8af2af63 nix: override apple-sdk to 26.2 and enable MLX_BUILD_CPU (#1
·
back to Exo
·
update mlx to 0.30.6 dc781497 →