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

Pretty-print mode to replace glob imports with a precise list of names #4786

Closed
bstrie opened this issue Feb 4, 2013 · 7 comments
Closed
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically

Comments

@bstrie
Copy link
Contributor

bstrie commented Feb 4, 2013

13:58 < bstrie> is there a pretty-print mode to replace a glob import with a
                precise list of names?
13:59 <@pcwalton> bstrie: no unfortunately
13:59 <@pcwalton> good idea though

So if I have a file with this:

use foo::*;

...and of all the things that foo provides, I only ever end up using bar and baz, then it should rewrite the import to:

use foo::{bar, baz};
@catamorphism
Copy link
Contributor

Added far-future milestone

@bblum
Copy link
Contributor

bblum commented Jul 29, 2013

Ooh, this would be great.

@huonw
Copy link
Member

huonw commented Nov 15, 2013

Triage: no change. Globs are now behind a #[feature] so this is probably slightly lower priority.

@pnkfelix
Copy link
Member

@huonw or maybe the feature guard makes this higher priority, since it would ease development shifting from local-hacking-mode that uses feature guards and relase-to-the-wild mode that tries to eschew feature guards. :)

@sanxiyn
Copy link
Member

sanxiyn commented Dec 28, 2014

cc @nick29581 who hinted at "a deglobber tool which would convert glob imports to proper imports" in #19254.

@nrc
Copy link
Member

nrc commented Dec 28, 2014

FTR, save-analysis now knows exactly the list of imports needed for this (since #19254), so all that is needed is to use that info in pretty printing.

I was actually thinking of making this an external tool, possibly a Cargo plugin. I've been playing around with an approach to this, but haven't got very far. If anyone wants to work on this, please ping me.

@steveklabnik
Copy link
Member

I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.

This issue has been moved to the RFCs repo: rust-lang/rfcs#617

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically
Projects
None yet
Development

No branches or pull requests

8 participants