Skip to content

Fix trailing newline in singleton tuple pretty printing - #274

Merged
coord-e merged 1 commit into
mainfrom
fix/singleton-tuple-pretty-print
Sep 23, 2026
Merged

coord-e merged 1 commit into
mainfrom
fix/singleton-tuple-pretty-print

Conversation

@coord-e

@coord-e coord-e commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Singleton tuple types append the element separator after their sole element, leaving a line break before the closing parenthesis. Append only the trailing comma so (own int,) prints without that break.

Move the separator into the multiple-element branch, preserving its existing wrapping behavior.

Validation: cargo fmt --all -- --check, cargo test --lib (3 passed), and git diff --check.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-23T13:12:47.107718Z 1db8cae PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

Adjusts pretty-printing of a 1-element tuple/type list to avoid allocating an unused separator builder and to ensure a trailing comma is emitted for the single-element case.

Changes:

  • Removes the top-level separator binding and scopes it to the multi-element branch.
  • Changes the single-element formatting to append a comma before wrapping in parentheses.
File Description
src/​rty.rs Tweaks pretty-printer separator handling for single vs multi element cases.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/rty.rs
let separator = allocator.text(",").append(allocator.line());
if self.elems.len() == 1 {
self.elems[0].pretty(allocator).append(separator).parens()
self.elems[0].pretty(allocator).append(",").parens()
Comment thread src/rty.rs
let separator = allocator.text(",").append(allocator.line());
if self.elems.len() == 1 {
self.elems[0].pretty(allocator).append(separator).parens()
self.elems[0].pretty(allocator).append(",").parens()
@coord-e
coord-e merged commit 74f503f into main Sep 23, 2026
6 of 7 checks passed
@coord-e
coord-e deleted the fix/singleton-tuple-pretty-print branch September 23, 2026 13:21
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.

2 participants