Skip to content

Conversation

@calebcartwright
Copy link
Member

Closes #3865

@calebcartwright
Copy link
Member Author

CI failures are due to issues with latest nightly, see #3864

Copy link
Contributor

@topecongiro topecongiro left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

src/closures.rs Outdated
let param_shape = nested_shape.offset_left(1)?.visual_indent(0);
let param_shape = match indent_style {
IndentStyle::Block => {
if version == Version::Two {
Copy link
Member Author

@calebcartwright calebcartwright Oct 25, 2019

Choose a reason for hiding this comment

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

I should drop the version gating from here since this would be a v2.x change (not going into v1.x) correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I will remove the version anyway so it would be helpful if you can remove it in this PR :)

Copy link
Contributor

@topecongiro topecongiro left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Just a bikeshedding on the style.

src/closures.rs Outdated
IndentStyle::Block => list_str.contains('\n') || list_str.len() > one_line_budget,
_ => false,
};
let (param_str, put_params_in_block) = if multi_line_params && !item_vec.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: would you mind simplifying this if block into something like the following

let put_params_in_block = multi_line_params && !item_vec.is_empty();
let param_str = if !put_params_in_block {
    list_str
} else {
    // ...
};

Copy link
Member Author

@calebcartwright calebcartwright Oct 26, 2019

Choose a reason for hiding this comment

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

Nit: would you mind simplifying this if block into something like the following

Good spot, that's a small change but definitely helps improve readability 👍 I will update it accordingly

@topecongiro topecongiro merged commit e0077aa into rust-lang:master Oct 27, 2019
@calebcartwright calebcartwright deleted the closure-block-style branch October 27, 2019 23:03
ytmimi pushed a commit to ytmimi/rustfmt that referenced this pull request Mar 31, 2022
@ytmimi ytmimi added 1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release and removed backport-triage labels Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1x-backport:pending Fixed/resolved in source but not yet backported to a 1x branch and release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uses visual style for long closure arguments

4 participants