-
Notifications
You must be signed in to change notification settings - Fork 933
Fix/Inconsistent Struct Body Opening Brace Placement After Where Clause #5508
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
jmj0502
wants to merge
12
commits into
rust-lang:master
Choose a base branch
from
jmj0502:fix/issue-5507
base: master
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 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0ee1308
Improvements: Adding the tests cases for the issue
jmj0502 2e46b4c
Improvements: The formatting for generic structs containing where cla…
jmj0502 58e2a54
Bugfix: Removing unnecesary value.
jmj0502 b3e3651
Improvements: A refactor was performed in order to improve readabilit…
jmj0502 b5323ca
Improvements: Removing unnecessary comments.
jmj0502 0c0fb58
Improvements: Removing additional line break.
jmj0502 254c829
Improvements: Now empty impl blocks and impl blocks containing single…
jmj0502 088369e
Improvements: replacing &snippet[comment_start..] for comment_snippet…
jmj0502 f526382
Improvements: Removing unnecesary match clause (fields.is_empty()) [i…
jmj0502 c5098f8
Improvements: Making changes to the signature of the set_struct_brace…
jmj0502 5cd84e1
Improvements: Now the inner_span variable is hoisted on the outter mo…
jmj0502 64a2321
Merge branch 'master' into fix/issue-5507
jmj0502 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// rustfmt-version: One | ||
|
||
struct EmptyBody<T> | ||
where T: Eq { | ||
} | ||
|
||
struct LineComment<T> | ||
where T: Eq { | ||
// body | ||
} | ||
|
||
struct MultiLineComment<T> | ||
where T: Eq { | ||
/* | ||
Multiline | ||
comment. | ||
*/ | ||
} | ||
|
||
struct BlockComment<T> | ||
where T: Eq { | ||
/* block comment */ | ||
} | ||
|
||
struct HasBody<T> | ||
where T: Eq { | ||
x: T | ||
} |
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-version: Two | ||
|
||
struct EmptyBody<T> | ||
where T: Eq { | ||
} | ||
|
||
struct LineComment<T> | ||
where T: Eq { | ||
// body | ||
} | ||
|
||
struct MultiLineComment<T> | ||
where T: Eq { | ||
/* | ||
Multiline | ||
comment. | ||
*/ | ||
} | ||
|
||
struct BlockComment<T> | ||
where T: Eq { | ||
/* block comment */ | ||
} | ||
|
||
struct HasBody<T> | ||
where T: Eq { | ||
x: T | ||
} |
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,31 @@ | ||
// rustfmt-version: One | ||
|
||
struct EmptyBody<T> | ||
where | ||
T: Eq, {} | ||
|
||
struct LineComment<T> | ||
where | ||
T: Eq, { | ||
// body | ||
} | ||
|
||
struct MultiLineComment<T> | ||
where | ||
T: Eq, { | ||
/* | ||
Multiline | ||
comment. | ||
*/ | ||
} | ||
|
||
struct BlockComment<T> | ||
where | ||
T: Eq, {/* block comment */} | ||
|
||
struct HasBody<T> | ||
where | ||
T: Eq, | ||
{ | ||
x: T, | ||
} |
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,33 @@ | ||
// rustfmt-version: Two | ||
|
||
struct EmptyBody<T> | ||
where | ||
T: Eq, {} | ||
|
||
struct LineComment<T> | ||
where | ||
T: Eq, | ||
{ | ||
// body | ||
} | ||
|
||
struct MultiLineComment<T> | ||
where | ||
T: Eq, | ||
{ | ||
/* | ||
Multiline | ||
comment. | ||
*/ | ||
} | ||
|
||
struct BlockComment<T> | ||
where | ||
T: Eq, {/* block comment */} | ||
|
||
struct HasBody<T> | ||
where | ||
T: Eq, | ||
{ | ||
x: T, | ||
} |
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.
I took a look, and I think we could simplify the logic here as follows:
Note: I renamed
set_brace_pos
toset_struct_brace_pos
to be more explicit.At the call site we can hoist
inner_span
from line 1329 so we can use that as thespan
argument toset_struct_brace_pos
. Let me know if all that makes sense.