Skip to content

Support for use_nested_groups Feature #2544

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
cramertj opened this issue Mar 19, 2018 · 4 comments · Fixed by #2603
Closed

Support for use_nested_groups Feature #2544

cramertj opened this issue Mar 19, 2018 · 4 comments · Fixed by #2603

Comments

@cramertj
Copy link
Member

Now that rust-lang/rust#44494 has been stabilized, it would be nice to have a rustfmt option to reformat all imports into the use_nested_groups format.

@nikomatsakis
Copy link

We should decide what is the idiomatic way to use_nested_groups. For example, I had code like this:

use chalk_engine::{
    context,
    ExClause,
    hh::HhGoal,
};

use rustc::{
    infer::InferOk, 
    infer::canonical::{Canonical, CanonicalVarValues},
    traits::ProgramClause, 
    ty::subst::Kind,
    ty::{Binder, OutlivesPredicate, Region, Ty, TyCtxt},
};

which was reformatted into:

use chalk_engine::{context, ExClause, hh::HhGoal};

use rustc::{infer::InferOk, infer::canonical::{Canonical, CanonicalVarValues},
            traits::ProgramClause, ty::subst::Kind,
            ty::{Binder, OutlivesPredicate, Region, Ty, TyCtxt}};

The current output doesn't feel right to me; it's hard to skim the names etc, but I can see how rustfmt reached that point. I'm not sure if the style I was using is the "right" one, but I sort of like it: basically like having the first import (the crate) be special, and each line below is sort of like a use statement of its own.

@topecongiro
Copy link
Contributor

cc rust-lang/style-team#24.

@cramertj
Copy link
Member Author

@nrc Should this be reopened, or should we open a new issue to discuss the formatting that @nikomatsakis mentioned above?

@nrc
Copy link
Member

nrc commented Apr 12, 2018

@cramertj we should discuss on rust-lang/style-team#24

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

Successfully merging a pull request may close this issue.

4 participants