-
-
Notifications
You must be signed in to change notification settings - Fork 746
Sort imports in Phobos #5478
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
Merged
Merged
Sort imports in Phobos #5478
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,7 +165,7 @@ if (isBidirectionalRange!Range) | |
| @safe unittest | ||
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.stdio, std.range; | ||
| import std.range, std.stdio; | ||
| import std.typecons : tuple; | ||
|
|
||
| ulong counter = 0; | ||
|
|
@@ -682,8 +682,8 @@ private struct MapResult(alias fun, Range) | |
| @safe unittest | ||
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.internal.test.dummyrange; | ||
| import std.ascii : toUpper; | ||
| import std.internal.test.dummyrange; | ||
| import std.range; | ||
| import std.typecons : tuple; | ||
|
|
||
|
|
@@ -1959,8 +1959,8 @@ version(none) // this example requires support for non-equivalence relations | |
| /* FIXME: pure @safe nothrow*/ @system unittest | ||
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.typecons : tuple; | ||
| import std.range.primitives; | ||
| import std.typecons : tuple; | ||
|
|
||
| // Grouping by particular attribute of each element: | ||
| auto range = | ||
|
|
@@ -2296,8 +2296,8 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR) | |
| @system unittest | ||
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.range.primitives; | ||
| import std.range.interfaces; | ||
| import std.range.primitives; | ||
| // joiner() should work for non-forward ranges too. | ||
| auto r = inputRangeObject(["abc", "def"]); | ||
| assert(equal(joiner(r, "xyz"), "abcxyzdef")); | ||
|
|
@@ -2607,8 +2607,8 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.algorithm.comparison : equal; | ||
| import std.algorithm.internal : algoFormat; | ||
|
|
||
| struct TransientRange | ||
| { | ||
|
|
@@ -2657,8 +2657,8 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR)) | |
| // Issue 8061 | ||
| @system unittest | ||
| { | ||
| import std.range.interfaces; | ||
| import std.conv : to; | ||
| import std.range.interfaces; | ||
|
|
||
| auto r = joiner([inputRangeObject("ab"), inputRangeObject("cd")]); | ||
| assert(isForwardRange!(typeof(r))); | ||
|
|
@@ -2748,7 +2748,7 @@ if (fun.length >= 1) | |
|
|
||
| alias binfuns = staticMap!(binaryFun, fun); | ||
| static if (fun.length > 1) | ||
| import std.typecons : tuple, isTuple; | ||
| import std.typecons : isTuple, tuple; | ||
|
|
||
| /++ | ||
| No-seed version. The first element of $(D r) is used as the seed's value. | ||
|
|
@@ -3219,7 +3219,7 @@ if (fun.length >= 1) | |
| // Sum all elements with explicit seed | ||
| assert(arr.fold!((a, b) => a + b)(6) == 21); | ||
|
|
||
| import std.algorithm.comparison : min, max; | ||
| import std.algorithm.comparison : max, min; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
| import std.typecons : tuple; | ||
|
|
||
| // Compute minimum and maximum at the same time | ||
|
|
@@ -3848,9 +3848,9 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.internal.test.dummyrange; | ||
| import std.algorithm; | ||
| import std.array : array; | ||
| import std.internal.test.dummyrange; | ||
| import std.range : retro; | ||
|
|
||
| assert(equal(splitter("hello world", ' '), [ "hello", "", "world" ])); | ||
|
|
@@ -4095,8 +4095,8 @@ if (is(typeof(binaryFun!pred(r.front, s.front)) : bool) | |
| @safe unittest | ||
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.conv : text; | ||
| import std.array : split; | ||
| import std.conv : text; | ||
|
|
||
| auto s = ",abc, de, fg,hi,"; | ||
| auto sp0 = splitter(s, ','); | ||
|
|
@@ -4360,8 +4360,8 @@ private struct SplitterResult(alias isTerminator, Range) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.algorithm.comparison : equal; | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.internal.test.dummyrange; | ||
|
|
||
| void compare(string sentence, string[] witness) | ||
|
|
@@ -4395,8 +4395,8 @@ private struct SplitterResult(alias isTerminator, Range) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.algorithm.comparison : equal; | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.range; | ||
|
|
||
| struct Entry | ||
|
|
@@ -4560,10 +4560,10 @@ if (isSomeChar!C) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.algorithm.comparison : equal; | ||
| import std.conv : text; | ||
| import std.algorithm.internal : algoFormat; | ||
| import std.array : split; | ||
| import std.conv : text; | ||
|
|
||
| // Check consistency: | ||
| // All flavors of split should produce the same results | ||
|
|
@@ -4953,8 +4953,8 @@ if (isInputRange!Range && is(typeof(binaryFun!pred(r.front, r.front)) == bool)) | |
| /// | ||
| @safe unittest | ||
| { | ||
| import std.algorithm.mutation : copy; | ||
| import std.algorithm.comparison : equal; | ||
| import std.algorithm.mutation : copy; | ||
|
|
||
| int[] arr = [ 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 ]; | ||
| assert(equal(uniq(arr), [ 1, 2, 3, 4, 5 ][])); | ||
|
|
@@ -5125,8 +5125,8 @@ if (isRandomAccessRange!Range && hasLength!Range) | |
| /// | ||
| this(Range r) | ||
| { | ||
| import std.range : iota; | ||
| import std.array : array; | ||
| import std.range : iota; | ||
|
|
||
| this._r = r; | ||
| _state = r.length ? new size_t[r.length-1] : null; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,7 +78,7 @@ T2=$(TR $(TDNW $(LREF $1)) $(TD $+)) | |
| module std.algorithm.mutation; | ||
|
|
||
| import std.range.primitives; | ||
| import std.traits : isArray, isBlitAssignable, isNarrowString, Unqual, isSomeChar; | ||
| import std.traits : isArray, isBlitAssignable, isNarrowString, isSomeChar, Unqual; | ||
| // FIXME | ||
| import std.typecons; // : tuple, Tuple; | ||
|
|
||
|
|
@@ -148,8 +148,8 @@ if (isInputRange!InputRange && isForwardRange!ForwardRange) | |
| private size_t bringToFrontImpl(InputRange, ForwardRange)(InputRange front, ForwardRange back) | ||
| if (isInputRange!InputRange && isForwardRange!ForwardRange) | ||
| { | ||
| import std.range : take, Take; | ||
| import std.array : sameHead; | ||
| import std.range : take, Take; | ||
| enum bool sameHeadExists = is(typeof(front.sameHead(back))); | ||
| size_t result; | ||
|
|
||
|
|
@@ -279,7 +279,7 @@ Unicode integrity is not preserved: | |
| { | ||
| import std.algorithm.comparison : equal; | ||
| import std.conv : text; | ||
| import std.random : Random, unpredictableSeed, uniform; | ||
| import std.random : Random, uniform, unpredictableSeed; | ||
|
|
||
| // a more elaborate test | ||
| { | ||
|
|
@@ -845,7 +845,7 @@ See_Also: | |
| void initializeAll(Range)(Range range) | ||
| if (isInputRange!Range && hasLvalueElements!Range && hasAssignableElements!Range) | ||
| { | ||
| import core.stdc.string : memset, memcpy; | ||
| import core.stdc.string : memcpy, memset; | ||
| import std.traits : hasElaborateAssign, isDynamicArray; | ||
|
|
||
| alias T = ElementType!Range; | ||
|
|
@@ -901,7 +901,7 @@ if (is(Range == char[]) || is(Range == wchar[])) | |
| /// | ||
| @system unittest | ||
| { | ||
| import core.stdc.stdlib : malloc, free; | ||
| import core.stdc.stdlib : free, malloc; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
|
|
||
| struct S | ||
| { | ||
|
|
@@ -1095,8 +1095,8 @@ pure nothrow @safe @nogc unittest | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.traits; | ||
| import std.exception : assertCTFEable; | ||
| import std.traits; | ||
|
|
||
| assertCTFEable!((){ | ||
| Object obj1 = new Object; | ||
|
|
@@ -1209,8 +1209,8 @@ private T moveImpl(T)(ref T source) | |
|
|
||
| @safe unittest | ||
| { | ||
| import std.traits; | ||
| import std.exception : assertCTFEable; | ||
| import std.traits; | ||
|
|
||
| assertCTFEable!((){ | ||
| Object obj1 = new Object; | ||
|
|
@@ -2835,7 +2835,7 @@ if (isInputRange!Range && hasLvalueElements!Range && is(typeof(range.front = val | |
| /// | ||
| nothrow @system unittest | ||
| { | ||
| import core.stdc.stdlib : malloc, free; | ||
| import core.stdc.stdlib : free, malloc; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👎 |
||
|
|
||
| auto s = (cast(int*) malloc(5 * int.sizeof))[0 .. 5]; | ||
| uninitializedFill(s, 42); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@andralex if we want to enforce sortedness for all imports, we have to look over a few minor exceptions where the order makes a bit of sense.
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.
I'm not too worried about the few hand-optimizations that could be done. I'd say sorted is the simple and effective way.
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.
👎