Skip to content

Replace single itertools use in hub-tui with stdlib to remove the dependency #165

Closed

Description

@ooloth

Why

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

  1. Open ui/tui/Cargo.toml — expect itertools to be absent from [dependencies].
  2. Run cargo build -p hub-tui — expect a clean compile with no errors.
  3. Run cargo test -p hub-tui — expect all tests to pass.
  4. 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.

Activity

  1. ooloth commented on Nov 5, 2026

    @ooloth
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    author:agentThis was authored by an agent.maintenanceKeeps code, docs or tooling healthystatus:needs-human-reviewA human should validate this before an agent works on it.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions