Skip to content

chore: adopt edition 2024, in-tree lint policy, and rustfmt config#76

Merged
amittamari merged 3 commits into
masterfrom
oxc-inspired-phase1
Jul 12, 2026
Merged

chore: adopt edition 2024, in-tree lint policy, and rustfmt config#76
amittamari merged 3 commits into
masterfrom
oxc-inspired-phase1

Conversation

@amittamari

Copy link
Copy Markdown
Owner

Adopts oxc-inspired Rust tooling discipline. Pragmatic scope: no new runtime dependencies, no pedantic/nursery churn.

Changes

  • Edition 2024. cargo fix required no source migration; now-stable let-chains let clippy::collapsible_if merge several nested if / if let blocks (adapters, config, hooks, index, query, columns).
  • [lints] table in Cargo.toml so the "warnings are errors" contract CI enforces (clippy --all-targets --all-features -- -D warnings) is visible in-tree and to IDEs. clippy::all plus a small set of high-signal restriction lints (clone_on_ref_ptr, format_push_string, dbg_macro, todo, unimplemented, undocumented_unsafe_blocks), each opt-in documented.
  • rustfmt.toml (style_edition 2024, use_small_heuristics = "Max", field-init shorthand). The mass reformat is isolated in its own commit for reviewability.
  • Removed the unused thiserror dependency.
  • Fixed a stale path in docs/ARCHITECTURE.md (src/columns.rssrc/tui/columns.rs).

Verification

  • cargo fmt --all -- --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo test — 277 pass

🤖 Generated with Claude Code

amittamari and others added 2 commits July 12, 2026 16:31
Bring hop's Rust tooling discipline in line with reference projects (oxc):

- Bump to edition 2024. cargo fix required no source migration; the
  now-stable let-chains let clippy::collapsible_if merge several nested
  `if` / `if let` blocks (adapters, config, hooks, index, query, columns).
- Add a `[lints]` table so the "warnings are errors" contract CI enforces
  is visible in-tree and to IDEs. Pragmatic subset: clippy::all plus a few
  high-signal restriction lints (clone_on_ref_ptr, format_push_string,
  dbg_macro, todo, unimplemented, undocumented_unsafe_blocks), each opt-in
  documented. Not the full pedantic/nursery groups.
- Add rustfmt.toml (style_edition 2024, use_small_heuristics = "Max",
  field-init shorthand).
- Remove the unused `thiserror` dependency.
- Fix a stale path in docs/ARCHITECTURE.md (src/columns.rs -> src/tui/columns.rs).
- Switch a test off push_str(&format!(..)) to satisfy format_push_string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mechanical reformat only (no logic changes), produced by `cargo fmt` under
the rustfmt.toml added in the previous commit. Isolated here so review can
skip it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Previously every sync pass opened a fresh IndexWriter (index.writer()) and
dropped it at the end. Tantivy allows only one writer per directory at a time,
its writer lock is non-blocking (no retry), and a dropped writer releases the
lock only once its detached merge threads wind down. So a second sync pass over
the same index — as several engine tests do — could race the previous writer's
not-yet-released `.tantivy-writer.lock` and fail with `LockBusy` under parallel
test load. Per tantivy's own guidance (issue #550), the fix is to keep a single
writer rather than reopen one per operation.

- `SearchIndex` now owns `Mutex<Option<IndexWriter>>`, created lazily on the
  first write and reused for the handle's lifetime. Read-only handles never take
  the writer lock, preserving the reader/writer split between the UI engine and
  the background sync handle.
- `upsert`/`delete`/`commit` are now `&self` methods that route through the
  internal writer; callers no longer thread a `&mut IndexWriter`.
- `Drop for SearchIndex` calls `wait_merging_threads()` so the lock is released
  deterministically before another handle opens a writer on the same directory.
- Simplified the sync loop and the index_sync tests accordingly.

Verified with 6 consecutive full parallel `cargo test` runs (277 pass each).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@amittamari
amittamari force-pushed the oxc-inspired-phase1 branch from 88d922a to 32e0099 Compare July 12, 2026 14:17
@amittamari
amittamari merged commit 563a369 into master Jul 12, 2026
1 check passed
@amittamari
amittamari deleted the oxc-inspired-phase1 branch July 12, 2026 14:24
@amittamari amittamari mentioned this pull request Jul 12, 2026
amittamari added a commit that referenced this pull request Jul 13, 2026
Concrete, std-only allocation cleanups in the indexing parse loop and
the TUI render path. No new dependencies.

> Stacked on top of #76 (base = `oxc-inspired-phase1`). Rebase onto
`master` once #76 merges.

## Changes
- **Adapters:** reuse one decode buffer per file instead of allocating a
fresh `Vec<u8>` for every JSONL line (`clear` + `extend_from_slice`).
Applies to the Claude, Codex, and Cursor parse loops.
- **Results list:** compute each visible cell's `(text, style)` once per
frame (`compute_cells`), then feed the same grid to both the width
solver (`layout_from_cells`) and the row builder (`session_row`).
Previously every non-flex cell string was built twice per frame (measure
pass + build pass). This also halves the per-frame `document_key()`
probes for the PR column and lets `cell()`/`enrichment_cell()` take
`&RowCtx`, dropping the `too_many_arguments` allow.
- **Footer:** build the status line once and size its region from it
instead of rebuilding it just to measure the width
(`line_display_width`).
- **`Cow<str>`** for the no-op-common text transforms so they borrow
when the input is unchanged (the common case): `strip_codex_wrappers`,
`strip_redacted` (now fully allocation-free), and index `sanitize`.

## Note
Full elimination of the per-frame `document_key()` `format!` was
intentionally not pursued: the `resolved` map's `(String, &'static str)`
tuple key can't be probed with a borrowed key, so even a cached key
would still clone into the tuple. Removing it entirely would require
restructuring the map type across its construction sites and ~15 tests
for negligible gain. The grid change above already halves the calls.

## Verification
- `cargo fmt --all -- --check` clean
- `cargo clippy --all-targets --all-features -- -D warnings` clean
- `cargo test` — 277 pass. Adapter/index integration suites cover the
parse-path and `Cow` changes; `results_list` unit tests and `view.rs`
render-to-buffer snapshots cover the render-path changes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
amittamari added a commit that referenced this pull request Jul 13, 2026
## 🤖 New release

* `hop`: 0.2.8 -> 0.2.9

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.2.9](v0.2.8...v0.2.9) -
2026-07-13

### Added

- capture session model/commit and skip non-interactive threads
([#75](#75))
- harden Codex session parsing
([#74](#74))
- simple/raw search modes with guided toolbar
([#73](#73))
- hook-based session metadata enrichment
([#65](#65))

### Other

- trim hot-path allocations in indexing and TUI render
([#77](#77))
- adopt edition 2024, in-tree lint policy, and rustfmt config
([#76](#76))
- add DESIGN.md, codex-inspired review, and no-local-paths rule
- *(readme)* update demo
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant