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

Steps towards fixing #11983. #14548

Closed
wants to merge 1 commit into from
Closed

Steps towards fixing #11983. #14548

wants to merge 1 commit into from

Conversation

ahmedcharles
Copy link
Contributor

This isn't actually a fully-fledged pull request, but I'd like to make sure that this is the right direction for de-globbing?

@alexcrichton
Copy link
Member

In cases such as libsyntax with the ast, you generally have to import so many things that it's easier to just refer to everything via ast::Foo (at least so I've found), because maintaining the import lists at the top of the file are sometimes a bit painful. The other imports for things like codemap are find to expand to their individual components I think.

Also, is #11983 the issue you meant to refer to? It seems to reference libstd rather than libsyntax. Thanks for doing this by the way!

use ast::{TypeMethod, TyU, TyU8, TyU16, TyU32, TyU64, UintTy};
use ast::{UnBox, UnDeref, UnNeg, UnNot, UnOp, UnUniq};
use ast::{ViewItem, ViewItemExternCrate, ViewItemUse};
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple, Visibility};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dear god that's a lot of imports.

This seems like the perfect example of where glob imports are appropriate.

@ahmedcharles
Copy link
Contributor Author

The issue is the one that I wanted to refer to, because at some point, someone mentions doing this in the compiler in addition to simply in the library. And I think the library is mostly clean already.

And I'll switch to using ast::Foo instead of use statements for identifiers that are used a small number of times and probably retain use statements for those that are used a lot.

As for the philosophy of glob imports, I'm interested in seeing what this ends up looking like inside the rust compiler, since once they are removed from there, it's possible to see an example of a large codebase without globs and will help determine the usefulness of the feature.

I'll keep the pull request open and push to it for feedback as I work more on it.

@ahmedcharles
Copy link
Contributor Author

This fixes all of the files in this directory, so it's complete enough to be considered for approval and I can do other directories as separate requests.

@alexcrichton
Copy link
Member

Feel free to ping the PR whenever you update it, sadly github doesn't send out any notifications for a force push :(

@ahmedcharles
Copy link
Contributor Author

I was testing it to see if it failed and apparently there was a test failure on master that was causing the test runs to fail. Though, I'll remember that for next time.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

@ahmedcharles ahmedcharles deleted the deglob branch September 9, 2014 04:51
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants