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

Compact where clause style #2168

Closed
djc opened this issue Nov 19, 2017 · 4 comments
Closed

Compact where clause style #2168

djc opened this issue Nov 19, 2017 · 4 comments

Comments

@djc
Copy link
Contributor

djc commented Nov 19, 2017

rustfmt currently reformats my code like this, which doesn't seem like an improvement to me:

-pub trait FetchBuilderMessages where Self: Sized {
+pub trait FetchBuilderMessages
+where
+    Self: Sized,
+{

I find the 3 extra lines a bad trade-off in this case for the length of the where clause. However, looking at the configurations relating to where clauses, keeping them on the same line for clauses below some length limit does not seem to be an option.

@nrc
Copy link
Member

nrc commented Nov 19, 2017

where_single_line gives you a more compact layout. We're unlikely to ever single-line a trait decl and where clause (though I think we do it if the body is empty too).

@nrc nrc closed this as completed Nov 19, 2017
@djc
Copy link
Contributor Author

djc commented Nov 21, 2017

The README states you're mostly willing to add config options to accomodate different styles. Can you explain why this case is different?

@nrc
Copy link
Member

nrc commented Nov 21, 2017

Ah, sorry, the README is somewhat out of date in this respect (I didn't even remember that was there). That certainly was the case, but now that we have mostly settled on an 'official' style and we are approaching a 1.0 release, we are trying to consolidate the options and reduce the overall number.

@LoganDark
Copy link

LoganDark commented May 15, 2022

This is a blocker for me, preventing me from using rustfmt. I'm not sure if the official opinion on this has changed sometime in the past 5 years, but there is still no option for this so I'm just going to assume rustfmt intentionally does not support my code style.

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

No branches or pull requests

3 participants