rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

group_imports: add `ExternalCrate`

Open PatchMixolydic opened this issue 3 years ago • 3 comments

This is similar to the existing StdExternalCrate, but doesn't give std, core, and alloc their own group. Conceptually, std and friends are just external libraries (though they have some magical abilities thanks to lang items and rustc_attrs), so this is the style I naturally gravitated towards. Unfortunately, I'm not sure how common this pattern is throughout the ecosystem, and it even took one person by surprise when I brought it up. Nevertheless, at least four people seem to agree with this ordering at the time of writing, so I do hope this option will be useful to someone other than me.

PatchMixolydic avatar May 16 '22 17:05 PatchMixolydic

Thank you for the PR. Haven't had a chance to look at the diff and given the current backlog it may be a bit before we get to it. However, do want to acknowledge both having seen this as well as our openness to supporting other group_imports variants

calebcartwright avatar May 19 '22 02:05 calebcartwright

I think it would probably be worth some bikeshedding on the variant name. This might suffice in isolation, but we need to think about the variant name in the context of the other variants, and my concern is that ExternCrate doesn't implicitly connote how it differs from the existing StdExternCrate.

I can't think of a good name offhand either, but the style to me feels like a flavor of "everything else, and then crate" so I'd love to come up with a variant name that better reflects that

calebcartwright avatar Jun 16 '22 00:06 calebcartwright

Something like NoncrateCrate is perhaps more descriptive but a real mouthful :thinking:

calebcartwright avatar Jun 16 '22 00:06 calebcartwright

Sorry for the delay ^^;

Unfortunately, I haven't been able to think of a better name than NoncrateCrate in the past seven months. However, #5632 might obviate the need for a name (and this PR) altogether, so I'd like to see how that goes before pushing this PR further.

PatchMixolydic avatar Dec 14 '22 20:12 PatchMixolydic