-
Notifications
You must be signed in to change notification settings - Fork 933
Keep vertical spaces between items or statements within range #2221
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
Conversation
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.
Thanks for the PR! The code looks good, but I think the upper bound default should be 2 rather than 1. Could you also add a couple of tests checking some other configurations please? (In particular which require inserting newlines, with and without comments).
@@ -651,6 +651,10 @@ create_config! { | |||
"Add trailing semicolon after break, continue and return"; | |||
match_block_trailing_comma: bool, false, false, | |||
"Put a trailing comma after a block based match arm (non-block arms are not affected)"; | |||
blank_lines_upper_bound: usize, 1, false, |
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.
The default here should be 2.
Thank you for taking time to review this! I read your comment and it states that we should have either 0 or 1 blank line between items. Do you mean that the config values should represent the exclusive bound? |
This PR does not handle blank lines around comments. The blank lines in the example below will be kept untouched: fn foo()
// comment
fn bar() {} I am going to update this PR, add more tests. |
You are correct, sorry - my memory was not as good as I thought :-) |
Updated with handling of comments and tests. My apologies for messy commit history. |
Thank you! |
cc rust-lang/style-team#57.