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

Automatically nest use statement paths #4045

Closed
iago-lito opened this issue Feb 11, 2020 · 2 comments
Closed

Automatically nest use statement paths #4045

iago-lito opened this issue Feb 11, 2020 · 2 comments

Comments

@iago-lito
Copy link

I read in the book that mod statements like

use a::b;
use a::c;
use a::d::e;
use a::d::f;

Can be reformatted with nested paths like

use a::{
    b, c,
    d::{e, f},
};

What's a consensus about the right way to go?
Is it in the scope of rustfmt to automatically handle this?
If yes, how to configure rustfmt so it does?

@cynecx
Copy link

cynecx commented Feb 11, 2020

merge_imports (https://github.com/rust-lang/rustfmt/blob/master/Configurations.md).

@iago-lito
Copy link
Author

iago-lito commented Feb 11, 2020

@cynecx Thanks, so merge is the keyword I was missing instead of nest ;)

I read that the default value for this option is false, because the feature is not stabilized yet. See #3362 for discussion about it.

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

2 participants