Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upNested Paths in Use Statements #1400
Comments
This comment has been minimized.
This comment has been minimized.
|
This would be nice. |
This comment has been minimized.
This comment has been minimized.
rphmeier
commented
Dec 9, 2015
|
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. |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
I've wanted this many times. This should also come with a style-guide requiring the indentation. |
This comment has been minimized.
This comment has been minimized.
|
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
|
This comment has been minimized.
This comment has been minimized.
|
actually as I understand it it would still be one use statement per top level import:
|
This comment has been minimized.
This comment has been minimized.
|
@oli-obk |
This comment has been minimized.
This comment has been minimized.
|
I would hope the convention would be something like one use per top level though in general. |
nrc
added
the
T-lang
label
Aug 19, 2016
This comment has been minimized.
This comment has been minimized.
themihai
commented
Aug 25, 2016
|
What about grouping the
|
petrochenkov
referenced this issue
Feb 7, 2017
Closed
use multiple names from different submodules at once #39629
This comment has been minimized.
This comment has been minimized.
crumblingstatue
commented
Mar 24, 2017
•
|
If ergonomics really is a focus in 2016, then this would be a relatively simple, but useful ergonomic addition. |
nixpulvis commentedDec 9, 2015
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
useing 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 theusestatement 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.