Repository navigation
Fix rustfmt giving up on formatting when multi-line strings exceed max_width #6781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
thomasqueirozb
wants to merge
6
commits into
rust-lang:main
Choose a base branch
from
thomasqueirozb:fix-multiline-string-formatting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a11bb4e
Add test fixtures
thomasqueirozb bd7a20e
Add code fixing specific tests and breaking others
thomasqueirozb 03a9921
Add multiline string check
thomasqueirozb 804b375
Pass in style_edition into filtered_str_fits/wrap_str
thomasqueirozb 755be3f
2027 style-gate fixtures
thomasqueirozb 6d6461b
Feature gate formatting with 2027 edition
thomasqueirozb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| //@ rustfmt-style_edition: 2027 | ||
|
|
||
| fn test() { | ||
| let foo = [ | ||
| (b"Welcome to Ringboard!" as &[u8], &em), | ||
| ( | ||
| b"Ringboard is a fast, efficient, and composable clipboard manager for Linux." | ||
| , &em, | ||
| ), | ||
| ( | ||
| b"It supports both Wayland and X11 along with multiple clients to manage your \ | ||
| clipboard history." | ||
| , &em, | ||
| ), | ||
| ( | ||
| b"Clients include a standard GUI, an interactive TUI, and a CLI for all your scripting \ | ||
| needs." | ||
| , &em, | ||
| ), | ||
| ( | ||
| "Ringboard can copy arbitrary bytes—that includes images!".as_bytes(), | ||
| &em, | ||
| ), | ||
| ( | ||
| b"Plaintext and RegEx search are available for fast entry retrieval.", | ||
| &em, | ||
| ), | ||
| (b"Enjoy this image from our AI overlords:", &em), | ||
| ( | ||
| include_bytes!("../logo.jpeg") as &[u8], | ||
| &MimeType::from("image/jpeg").unwrap(), | ||
| ), | ||
| ( | ||
| b"Finally, it's worth mentioning that Ringboard is extremely efficient, performant, \ | ||
| and scalable." | ||
| , &em, | ||
| ), | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| //@ rustfmt-style_edition: 2027 | ||
|
|
||
| #![allow(dead_code)] | ||
|
|
||
| struct Parameter { | ||
| required: bool, | ||
| description: &'static str, | ||
| } | ||
|
|
||
| pub struct Test; | ||
|
|
||
| impl Test { | ||
| fn parameters(&self) -> &'static [Parameter] { | ||
| &[ | ||
| Parameter { | ||
| required: true, | ||
| description: "Foo", | ||
| }, | ||
| Parameter { | ||
| required: false, | ||
| description: "Bar | ||
| This string is exactly 100 chars long. Delete one character to make it 99 chars long and it'll work!", | ||
| }, | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| //@ rustfmt-style_edition: 2027 | ||
|
|
||
| fn test() { | ||
| let foo = [ | ||
| (b"Welcome to Ringboard!" as &[u8], &em), | ||
| ( | ||
| b"Ringboard is a fast, efficient, and composable clipboard manager for Linux.", | ||
| &em, | ||
| ), | ||
| ( | ||
| b"It supports both Wayland and X11 along with multiple clients to manage your \ | ||
| clipboard history.", | ||
| &em, | ||
| ), | ||
| ( | ||
| b"Clients include a standard GUI, an interactive TUI, and a CLI for all your scripting \ | ||
| needs.", | ||
| &em, | ||
| ), | ||
| ( | ||
| "Ringboard can copy arbitrary bytes—that includes images!".as_bytes(), | ||
| &em, | ||
| ), | ||
| ( | ||
| b"Plaintext and RegEx search are available for fast entry retrieval.", | ||
| &em, | ||
| ), | ||
| (b"Enjoy this image from our AI overlords:", &em), | ||
| ( | ||
| include_bytes!("../logo.jpeg") as &[u8], | ||
| &MimeType::from("image/jpeg").unwrap(), | ||
| ), | ||
| ( | ||
| b"Finally, it's worth mentioning that Ringboard is extremely efficient, performant, \ | ||
| and scalable.", | ||
| &em, | ||
| ), | ||
| ]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| //@ rustfmt-style_edition: 2027 | ||
|
|
||
| #![allow(dead_code)] | ||
|
|
||
| struct Parameter { | ||
| required: bool, | ||
| description: &'static str, | ||
| } | ||
|
|
||
| pub struct Test; | ||
|
|
||
| impl Test { | ||
| fn parameters(&self) -> &'static [Parameter] { | ||
| &[ | ||
| Parameter { | ||
| required: true, | ||
| description: "Foo", | ||
| }, | ||
| Parameter { | ||
| required: false, | ||
| description: "Bar | ||
| This string is exactly 100 chars long. Delete one character to make it 99 chars long and it'll work!", | ||
| }, | ||
| ] | ||
| } | ||
| } | ||
|
|
||
| fn main() {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't sure if it was better to pass in
StyleEditionorContext<'_>here. Sincemax_widthwas already present I opted forStyleEdition