You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace single itertools use in hub-tui with stdlib to remove the dependency #165
hub-tui depends on itertools for a single .with_position() call that can be replaced with a few lines of standard Rust, removing an unjustified dependency and its ongoing maintenance obligation.
Current state
ui/tui/Cargo.toml declares itertools = "0.14" under [dependencies]. The only usage in the entire crate is in ui/tui/src/markdown/mod.rs at approximately line 283, where .with_position() is called to detect the position of each element (first, middle, last) in an iterator. This single call site does not justify importing an external utility crate when std::iter provides the primitives needed to implement the same logic inline (e.g., via .peekable() with .peek().is_none() to detect the last element).
Ideal state
ui/tui/Cargo.toml contains no itertools entry under [dependencies].
ui/tui/src/markdown/mod.rs achieves the equivalent position-detection behavior using std::iter (e.g., enumerate() plus a precomputed length, or a Peekable iterator).
Cargo.lock no longer pins itertools as a direct dependency of hub-tui.
Starting points
ui/tui/Cargo.toml — the [dependencies] section declaring itertools = "0.14".
ui/tui/src/markdown/mod.rs line ~283 — the .with_position() call site to replace.
QA plan
Open ui/tui/Cargo.toml — expect itertools to be absent from [dependencies].
Run cargo build -p hub-tui — expect a clean compile with no errors.
Run cargo test -p hub-tui — expect all tests to pass.
Launch hub tui and navigate to a view that renders Markdown — expect the layout to display correctly with no visual regression around list items or paragraph breaks.
Done when
itertools is removed from ui/tui/Cargo.toml and hub-tui compiles and renders Markdown correctly without it.
Finished by #401 (merged as 5c7dec4). ui/tui/Cargo.toml no longer declares itertools, and the one with_position() call, now in ui/tui/src/markdown/render.rs, uses enumerate(). itertools stays in Cargo.lock only as ratatui's own dependency.
Activity
ooloth commentedon Nov 5, 2026
Finished by #401 (merged as 5c7dec4).
ui/tui/Cargo.tomlno longer declaresitertools, and the onewith_position()call, now inui/tui/src/markdown/render.rs, usesenumerate().itertoolsstays inCargo.lockonly as ratatui's own dependency.