Skip to content
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

Uses visual style for long closure arguments #3865

Open
joshtriplett opened this issue Oct 15, 2019 · 3 comments · Fixed by #3867
Open

Uses visual style for long closure arguments #3865

joshtriplett opened this issue Oct 15, 2019 · 3 comments · Fixed by #3867

Comments

@joshtriplett
Copy link
Member

joshtriplett commented Oct 15, 2019

rustfmt seems to use visual style rather than block style when reformatting long closure argument lists:

    let write_status = |status: &mut Vec<ansi_term::ANSIString>,
                        diff: &Diff,
                        heading: &str,
                        color: &Style,
                        show_hints: bool,
                        hints: &[&str]|
     -> Result<bool> {

One possible block-style alternative rustfmt could use:

    let write_status = |
        status: &mut Vec<ansi_term::ANSIString>,
        diff: &Diff,
        heading: &str,
        color: &Style,
        show_hints: bool,
        hints: &[&str]
    | -> Result<bool> {
@calebcartwright
Copy link
Member

Yeah even though block indent style is the default for everything else, closures seem to be the exception that are always formatted with visual style.

I'll open a PR today with an update (version gated) to leverage the indent_style config option when formating the closure to offer consistency with function declarations.

@topecongiro
Copy link
Contributor

cc rust-lang/style-team#138.

@calebcartwright
Copy link
Member

Reopening as this was closed as part of a change applied to a now-defunct and abandoned branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants