Files
zed/crates/language_core
Parker Loflin 36acea54c5 Remove dead code and redundant checks in language and text crates (#67151)
## Summary

Removes unused code and redundant work. No behavior changes.

- `language`: removes unused `Buffer` and `BufferSnapshot` methods and
`proto::deserialize_selections`, plus an `is_empty` check before a loop
in `randomly_undo_redo`. Examples: `build_empty_snapshot`,
`highlighted_text_for_range`, `syntax_root_ancestor`.
- `languages`: removes the unused `LANGUAGE_GIT_COMMIT` and its optional
`tree-sitter-gitcommit` dependency. The `grammars` crate still registers
the grammar.
- `text`: nothing called the test `Network`'s disconnect helpers, so
`disconnected_peers` was always empty. Removes it and its checks.
- `toolchain_selector`: removes the never-read `language` field and the
task that loaded it. Also removes a `.map(|this| if false { .. } else {
.. })` whose first branch could never run.
- `picker_preview`: removes the never-read `current_path` field.
- `html_to_markdown`: compares attribute names without allocating a
`String`.
- `markdown`, `markdown_preview`: `SharedString::from(s.to_string())`
becomes `SharedString::from(s)`.
- Also removes:
- unused items in `buffer_diff`, `rope`, `sum_tree`, `fuzzy_nucleo` and
`language_core`
  - `.peekable()` calls that never peek
  - unused lifetimes
- the empty `test-support` features in `language_core` and
`markdown_preview`

## Testing

- `./script/clippy`
- `cargo test -p language -p languages -p text -p markdown -p
markdown_preview -p toolchain_selector -p html_to_markdown`

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-19 12:47:09 +00:00
..