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

Two closures as function call arguments #1713

Closed
ghost opened this issue Jun 17, 2017 · 1 comment
Closed

Two closures as function call arguments #1713

ghost opened this issue Jun 17, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 17, 2017

I'm using Rayon and have code that looks like this:

rayon::join(
    || recurse(left, is_less, pred, limit),
    || recurse(right, is_less, Some(pivot), limit),
);

Rustfmt formats it to:

rayon::join(|| recurse(left, is_less, pred, limit), || {
    recurse(right, is_less, Some(pivot), limit)
});

This looks quite inconsistent. Why would the first closure be kept in the first line, but the other is split accross multiple lines?

It seems that we need another rule with regards to the closure-as-last-argument in functions calls:
If the argument list contains multiple closures, then each argument is placed on a dedicated line.

@nrc
Copy link
Member

nrc commented Jun 17, 2017

It seems that we need another rule with regards to the closure-as-last-argument in functions calls

Agreed

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

No branches or pull requests

2 participants