-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Nested Paths in Use Statements #1400
Comments
This would be nice. |
I personally find it harder to scan, but that may be because I'm accustomed to separate use statements. The one major complaint I have is that it requires more vertical scanning to determine what crate/module a type initially originates from. |
@rphmeier I imagine that in practice this will actually make it easier to scan for what crate/module something is from. This is because one need only to search by indentation for the use statements inside each crate/module. |
I've wanted this many times. This should also come with a style-guide requiring the indentation. |
It's a pretty logical extension to #1219 and it predecessors, I think it came up before. Something like
maybe with some restrictions on One thing that can be perceived as a drawback is that this extension changes the look of imports quite heavily. For example, look at some file with lots of imports, like https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser.rs
|
actually as I understand it it would still be one use statement per top level import:
|
@oli-obk |
I would hope the convention would be something like one use per top level though in general. |
What about grouping the
|
If ergonomics really is a focus in 2016, then this would be a relatively simple, but useful ergonomic addition. |
Use statements are a bit unwieldy from time to time. I find myself wanting to follow some kind of rule for how to do my use statements. One problem is with
use
ing many things from a single crate. For example:I think it would be nice to be able to collapse this into a single use statement as follows:
I know that not everyone will like this example, but the ability to have paths inside of the
{
,}
form of theuse
statement would be a nice addition in many cases. This feature seemed so intuitive to me I honestly almost expected it to already work like this.The text was updated successfully, but these errors were encountered: