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
std.format: clean imports #2666
Conversation
} | ||
version(unittest) { | ||
import core.vararg; | ||
import std.conv, std.exception, std.range, std.traits, std.typetuple; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to also move std.conv
into local imports? The fewer module-global imports, the better IMO, since it will make it much easier to split up Phobos modules into smaller, independent pieces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. fixed
btw, have you thought about writing an automated tool to make cleaning up imports easier? I have suggested the feature for dfix, maybe it's something you'd want to implement. It'd make cleaning up phobos much easier and be more widely useful for others too. |
Good idea! But phobos needs review. I have found 2 bugs. |
remove new private stuff add local import add local import remove global std.con import
rebased |
nested = to!(typeof(nested))(trailing[i + 1 .. k - 1]); | ||
sep = to!(typeof(nested))(trailing[k + 1 .. j - 1]); | ||
nested = trailing[i + 1 .. k - 1]; | ||
sep = trailing[k + 1 .. j - 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is to don't import std.conv: this to!
do nothing for const(Char)[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const(Char)[] a;
...
assert(to!(typeof(a))a is a);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks!
LGTM |
Auto-merge toggled on |
Thanks! |
My bad. Please merge #2683. |
Issue 13253 - use more scoped imports in phobos
See also: #2661