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

top-level uses are grouped up onto one line #3547

Closed
cramertj opened this issue May 10, 2019 · 5 comments
Closed

top-level uses are grouped up onto one line #3547

cramertj opened this issue May 10, 2019 · 5 comments
Labels
a-imports `use` syntax duplicate only-with-option requires a non-default option value to reproduce poor-formatting
Milestone

Comments

@cramertj
Copy link
Member

cramertj commented May 10, 2019

I know I've filed issues like this before, but I couldn't find the right one, so I'm opening this one again:

use {
    fidl::endpoints::RequestStream,
    fuchsia_async as fasync,
    fuchsia_zircon as zx,
    std::marker::PhantomData,
};

gets rustfmt'd into

use {
    fidl::endpoints::RequestStream, fuchsia_async as fasync, fuchsia_zircon as zx,
    std::marker::PhantomData,
};

which IMO is pretty clearly less readable.

@scampi
Copy link
Contributor

scampi commented May 10, 2019

have you tried the option imports_layout ? The variants HorizontalVertical or Vertical could be what you want.

@cramertj
Copy link
Member Author

No, I haven't, as I can't use unstable options, and any non-default formatting changes have to be approved for use in the project I work on. HorizontalVertical seems like what I would want, though.

In particular, it seems especially wrong to group multiple top-level crates onto the same line.

@mdittmer
Copy link

mdittmer commented Jul 2, 2019

FWIW, I would advocate putting every comma-separable entity on its own line (regardless of nesting) because version control systems can be of more assistance identifying and/or resolving conflicts precisely where they reside. The cost of extra lines is generally low, since most editor/viewer interfaces support folding bracketed lines.

I suspect that even enforcing this at least for top-level crates would go a long way.

@kellytk
Copy link

kellytk commented Sep 7, 2019

@cramertj

In particular, it seems especially wrong to group multiple top-level crates onto the same line.

While I personally prefer Vertical, #3361 (comment) mentions a possible benefit.

@topecongiro topecongiro added a-imports `use` syntax only-with-option requires a non-default option value to reproduce poor-formatting labels Jun 7, 2020
@topecongiro topecongiro added this to the 3.0.0 milestone Jun 29, 2020
@ytmimi
Copy link
Contributor

ytmimi commented Jul 20, 2022

This is a duplicate of #3286

@ytmimi ytmimi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-imports `use` syntax duplicate only-with-option requires a non-default option value to reproduce poor-formatting
Projects
None yet
Development

No branches or pull requests

6 participants