Skip to content

Fix the clippy collapsible_match error in packages/agent's plain_text.rs #3574

Closed

Description

@mstomar125

Problem

With rustc/clippy 1.95, bun run rust:lint fails on main with one error in packages/agent/src/pty/plain_text.rs:97 (clippy::collapsible_match). The merge gate doesn't run clippy (#3563), so it landed green. It only showed up once the two nodespace-core errors in front of it were fixed (#3571).

packages/agent needs its owner's sign-off, so this fix is filed separately and not bundled into #3571.

Ready-made fix (behaviour-preserving)

Use a match guard ... if !lines.current.is_empty(). An empty line then falls past the disjoint 'C' | 'G' arm to _ => {}, as it does today. #3571's reviewer checked this equivalence before it was split out.

diff --git a/packages/agent/src/pty/plain_text.rs b/packages/agent/src/pty/plain_text.rs
index 9dbdc7ca..aaa07302 100644
--- a/packages/agent/src/pty/plain_text.rs
+++ b/packages/agent/src/pty/plain_text.rs
@@ -93,10 +93,8 @@ pub fn strip_terminal_sequences(raw: &str) -> String {
                 // erasing, modes) leaves nothing.
                 '\u{40}'..='\u{7e}' => {
                     match c {
-                        'A' | 'B' | 'E' | 'F' | 'H' | 'd' | 'f' => {
-                            if !lines.current.is_empty() {
-                                lines.end_line();
-                            }
+                        'A' | 'B' | 'E' | 'F' | 'H' | 'd' | 'f' if !lines.current.is_empty() => {
+                            lines.end_line();
                         }
                         'C' | 'G' => lines.gap(),
                         _ => {}

Documentation

Acceptance criteria

  • bun run rust:lint passes on main.
  • nodespace-agent's plain_text tests still pass.

🤖 Generated with Claude Code

Activity

  1. self-assigned this
    on Oct 5, 2026
  2. added a commit that references this issue on Oct 5, 2026
    73c93b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions