Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ auto castSwitch(choices...)(Object switchObject)

if (classInfo == typeid(CastClass))
{
static if(is(ReturnType!(choice) == void))
static if (is(ReturnType!(choice) == void))
{
choice(cast(CastClass) switchObject);
static if (areAllHandlersVoidResult)
Expand Down Expand Up @@ -308,7 +308,7 @@ auto castSwitch(choices...)(Object switchObject)
{
if (auto castedObject = cast(choiceParameterTypes[0]) switchObject)
{
static if(is(ReturnType!(choice) == void))
static if (is(ReturnType!(choice) == void))
{
choice(castedObject);
static if (areAllHandlersVoidResult)
Expand Down Expand Up @@ -345,7 +345,7 @@ auto castSwitch(choices...)(Object switchObject)

if (switchObject is null)
{
static if(is(ReturnType!(choice) == void))
static if (is(ReturnType!(choice) == void))
{
choice();
static if (areAllHandlersVoidResult)
Expand Down
4 changes: 2 additions & 2 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ template map(fun...) if (fun.length >= 1)
alias _fun = adjoin!_funs;

// Once DMD issue #5710 is fixed, this validation loop can be moved into a template.
foreach(f; _funs)
foreach (f; _funs)
{
static assert(!is(typeof(f(RE.init)) == void),
"Mapping function(s) must not return void: " ~ _funs.stringof);
Expand Down Expand Up @@ -4263,7 +4263,7 @@ unittest
@safe pure nothrow @nogc unittest
{
import std.range;
foreach(n; iota(50))
foreach (n; iota(50))
assert(repeat(1.0, n).sum == n);
}

Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ unittest
assert (!typeid(S3).initializer().ptr);
assert ( typeid(S4).initializer().ptr);

foreach(S; AliasSeq!(S1, S2, S3, S4))
foreach (S; AliasSeq!(S1, S2, S3, S4))
{
//initializeAll
{
Expand Down
10 changes: 5 additions & 5 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ if (isNarrowString!R1 && isNarrowString!R2)
wchar[], const(wchar)[], wstring,
dchar[], const(dchar)[], dstring))
{
foreach(T; AliasSeq!(string, wstring, dstring))
foreach (T; AliasSeq!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
assert(commonPrefix(to!S(""), to!T("")).empty);
assert(commonPrefix(to!S(""), to!T("hello")).empty);
Expand Down Expand Up @@ -1425,9 +1425,9 @@ if (isInputRange!InputRange &&
@safe pure unittest
{
import std.meta : AliasSeq;
foreach(R; AliasSeq!(string, wstring, dstring))
foreach (R; AliasSeq!(string, wstring, dstring))
{
foreach(E; AliasSeq!(char, wchar, dchar))
foreach (E; AliasSeq!(char, wchar, dchar))
{
R r1 = "hello world";
E e1 = 'w';
Expand Down Expand Up @@ -1474,9 +1474,9 @@ if (isInputRange!InputRange &&
{
byte[] sarr = [1, 2, 3, 4];
ubyte[] uarr = [1, 2, 3, 4];
foreach(arr; AliasSeq!(sarr, uarr))
foreach (arr; AliasSeq!(sarr, uarr))
{
foreach(T; AliasSeq!(byte, ubyte, int, uint))
foreach (T; AliasSeq!(byte, ubyte, int, uint))
{
assert(find(arr, cast(T) 3) == arr[2 .. $]);
assert(find(arr, cast(T) 9) == arr[$ .. $]);
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/setops.d
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ private:
do {
next.popFront();
if (next.empty) return;
} while(comp(next.front, r.front));
} while (comp(next.front, r.front));
done = Rs.length;
}
if (--done == 0) return;
Expand Down
60 changes: 30 additions & 30 deletions std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ private size_t getPivot(alias less, Range)(Range r)
((cast(uint) (pred(r[0], r[len - 1]))) << 1) |
(cast(uint) (pred(r[mid], r[len - 1])));

switch(result) {
switch (result) {
case 0b001:
r.swapAt(0, len - 1);
r.swapAt(0, mid);
Expand Down Expand Up @@ -1243,7 +1243,7 @@ unittest
size_t[] arr;
arr.length = 1024;

foreach(k; 0..arr.length) arr[k] = k;
foreach (k; 0..arr.length) arr[k] = k;
swapRanges(arr[0..$/2], arr[$/2..$]);

sort!(pred, SwapStrategy.unstable)(arr);
Expand Down Expand Up @@ -1538,7 +1538,7 @@ private template TimSortImpl(alias pred, R)
if (stackLen == 2) assert(stack[0].length > stack[1].length);
else if (stackLen > 2)
{
foreach(k; 2 .. stackLen)
foreach (k; 2 .. stackLen)
{
assert(stack[k - 2].length > stack[k - 1].length + stack[k].length);
assert(stack[k - 1].length > stack[k].length);
Expand Down Expand Up @@ -1729,7 +1729,7 @@ private template TimSortImpl(alias pred, R)
immutable lef_end = temp.length - 1;

if (lef < lef_end && rig < range.length)
outer: while(true)
outer: while (true)
{
count_lef = 0;
count_rig = 0;
Expand All @@ -1740,14 +1740,14 @@ private template TimSortImpl(alias pred, R)
if (lessEqual(temp[lef], range[rig]))
{
range[i++] = temp[lef++];
if(lef >= lef_end) break outer;
if (lef >= lef_end) break outer;
++count_lef;
count_rig = 0;
}
else
{
range[i++] = range[rig++];
if(rig >= range.length) break outer;
if (rig >= range.length) break outer;
count_lef = 0;
++count_rig;
}
Expand All @@ -1758,14 +1758,14 @@ private template TimSortImpl(alias pred, R)
{
count_lef = gallopForwardUpper(temp[lef .. $], range[rig]);
foreach (j; 0 .. count_lef) range[i++] = temp[lef++];
if(lef >= temp.length) break outer;
if (lef >= temp.length) break outer;

count_rig = gallopForwardLower(range[rig .. range.length], temp[lef]);
foreach (j; 0 .. count_rig) range[i++] = range[rig++];
if (rig >= range.length) while(true)
if (rig >= range.length) while (true)
{
range[i++] = temp[lef++];
if(lef >= temp.length) break outer;
if (lef >= temp.length) break outer;
}

if (minGallop > 0) --minGallop;
Expand Down Expand Up @@ -1811,24 +1811,24 @@ private template TimSortImpl(alias pred, R)
size_t count_lef, count_rig;

outer:
while(true)
while (true)
{
count_lef = 0;
count_rig = 0;

// Linear merge
while((count_lef | count_rig) < minGallop)
while ((count_lef | count_rig) < minGallop)
{
if(greaterEqual(temp[rig], range[lef]))
if (greaterEqual(temp[rig], range[lef]))
{
range[i--] = temp[rig];
if(rig == 1)
if (rig == 1)
{
// Move remaining elements from left
while(true)
while (true)
{
range[i--] = range[lef];
if(lef == 0) break;
if (lef == 0) break;
--lef;
}

Expand All @@ -1844,10 +1844,10 @@ private template TimSortImpl(alias pred, R)
else
{
range[i--] = range[lef];
if(lef == 0) while(true)
if (lef == 0) while (true)
{
range[i--] = temp[rig];
if(rig == 0) break outer;
if (rig == 0) break outer;
--rig;
}
--lef;
Expand All @@ -1860,29 +1860,29 @@ private template TimSortImpl(alias pred, R)
do
{
count_rig = rig - gallopReverseLower(temp[0 .. rig], range[lef]);
foreach(j; 0 .. count_rig)
foreach (j; 0 .. count_rig)
{
range[i--] = temp[rig];
if(rig == 0) break outer;
if (rig == 0) break outer;
--rig;
}

count_lef = lef - gallopReverseUpper(range[0 .. lef], temp[rig]);
foreach(j; 0 .. count_lef)
foreach (j; 0 .. count_lef)
{
range[i--] = range[lef];
if(lef == 0) while(true)
if (lef == 0) while (true)
{
range[i--] = temp[rig];
if(rig == 0) break outer;
if (rig == 0) break outer;
--rig;
}
--lef;
}

if(minGallop > 0) --minGallop;
if (minGallop > 0) --minGallop;
}
while(count_lef >= minimalGallop || count_rig >= minimalGallop);
while (count_lef >= minimalGallop || count_rig >= minimalGallop);

minGallop += 2;
}
Expand Down Expand Up @@ -1992,7 +1992,7 @@ unittest
arr.length = 64 * 64;

// We want duplicate values for testing stability
foreach(i, ref v; arr) v.value = i / 64;
foreach (i, ref v; arr) v.value = i / 64;

// Swap ranges at random middle point (test large merge operation)
immutable mid = uniform(arr.length / 4, arr.length / 4 * 3, rnd);
Expand All @@ -2002,15 +2002,15 @@ unittest
randomShuffle(arr[$ / 8 * 7 .. $], rnd);

// Swap few random elements (test galloping mode)
foreach(i; 0 .. arr.length / 64)
foreach (i; 0 .. arr.length / 64)
{
immutable a = uniform(0, arr.length, rnd), b = uniform(0, arr.length, rnd);
swap(arr[a], arr[b]);
}

// Now that our test array is prepped, store original index value
// This will allow us to confirm the array was sorted stably
foreach(i, ref v; arr) v.index = i;
foreach (i, ref v; arr) v.index = i;

return arr;
}
Expand All @@ -2032,9 +2032,9 @@ unittest
assert(isSorted!comp(arr));

// Test that the array was sorted stably
foreach(i; 0 .. arr.length - 1)
foreach (i; 0 .. arr.length - 1)
{
if(arr[i].value == arr[i + 1].value) assert(arr[i].index < arr[i + 1].index);
if (arr[i].value == arr[i + 1].value) assert(arr[i].index < arr[i + 1].index);
}

return true;
Expand Down Expand Up @@ -3047,7 +3047,7 @@ bool nextEvenPermutation(alias less="a < b", BidirectionalRange)
reverse(takeExactly(retro(range), n));
if ((n / 2) % 2 == 1)
oddParity = !oddParity;
} while(oddParity);
} while (oddParity);

return ret;
}
Expand Down
Loading