Skip to content

Make format_buffer return a Vec<u8>#835

Merged
reese merged 2 commits intotrunkfrom
reese-format-buffer-u8
Feb 28, 2026
Merged

Make format_buffer return a Vec<u8>#835
reese merged 2 commits intotrunkfrom
reese-format-buffer-u8

Conversation

@reese
Copy link
Collaborator

@reese reese commented Feb 28, 2026

format_buffer currently returns a String and assumes that we always return valid UTF-8. With the changes I'm making for #832, this will no longer be the case, since Ruby source is not always UTF-8 encoded.

regex = "1.11.1"
rubyfmt = { path = "./librubyfmt" }
similar = "2.1.0"
similar = { version = "2.7.0", features = ["bytes"] }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The update to 2.7.0 is just to keep us current with the latest version -- it doesn't have any functional differences as far as I can tell, just a bit of 🧹

The bytes feature is so that we can pass u8 Vecs to TextDiff::from_lines, which by default only handles strings.

@reese reese merged commit 95833f0 into trunk Feb 28, 2026
8 checks passed
@reese reese deleted the reese-format-buffer-u8 branch February 28, 2026 00:47
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