From d6d3d8d9f5d4658946efc6d7d128d77b40ae6ad7 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Sat, 1 Aug 2026 09:52:11 +0100 Subject: [PATCH] Drop the dependency on the superslice crate It was only used to calculate the bin insertion point using the upper bound algorithm, but we can use the implementation from the standard library instead. --- Cargo.toml | 1 - src/histogram.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ea93f44..5a3f7b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ license = "MIT" [dependencies] ordered-float = "1.0" -superslice = "1" [dev-dependencies] criterion = "0.3.0" diff --git a/src/histogram.rs b/src/histogram.rs index a261af9..195d225 100644 --- a/src/histogram.rs +++ b/src/histogram.rs @@ -1,7 +1,6 @@ use std::borrow::Borrow; use ordered_float::OrderedFloat; -use superslice::*; use crate::bin::Bin; @@ -287,7 +286,8 @@ impl Histogram { // the configured size, the histogram is shrunk by merging two closest bins to restore // the invariant let bin = value.into(); - self.bins.insert(self.bins.upper_bound(&bin), bin); + self.bins + .insert(self.bins.partition_point(|x| x <= &bin), bin); self.shrink(); self.track_min_max(bin.value()); }