Skip to content

Commit 31dfc84

Browse files
committed
std.algorithm.{searching,sorting}: prepare for -dip1000
1 parent 990592c commit 31dfc84

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

std/algorithm/comparison.d

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,8 +1726,7 @@ equality). Returns a tuple with the reduced ranges that start with the
17261726
two mismatched values. Performs $(BIGOH min(r1.length, r2.length))
17271727
evaluations of `pred`.
17281728
*/
1729-
Tuple!(Range1, Range2)
1730-
mismatch(alias pred = "a == b", Range1, Range2)(Range1 r1, Range2 r2)
1729+
auto mismatch(alias pred = "a == b", Range1, Range2)(Range1 r1, Range2 r2)
17311730
if (isInputRange!(Range1) && isInputRange!(Range2))
17321731
{
17331732
for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront())

std/algorithm/sorting.d

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,17 +744,16 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && hasAssig
744744
assert(a == [ 42, 42 ]);
745745

746746
import std.algorithm.iteration : map;
747+
import std.format : format;
747748
import std.random;
748-
import std.stdio;
749749
auto s = 123_456_789;
750750
auto g = Xorshift(s);
751751
a = iota(0, uniform(1, 1000, g))
752752
.map!(_ => uniform(-1000, 1000, g))
753753
.array;
754-
scope(failure) writeln("RNG seed was ", s);
755754
pivot = pivotPartition!less(a, a.length / 2);
756-
assert(a[0 .. pivot].all!(x => x <= a[pivot]));
757-
assert(a[pivot .. $].all!(x => x >= a[pivot]));
755+
assert(a[0 .. pivot].all!(x => x <= a[pivot]), "RNG seed: %d".format(s));
756+
assert(a[pivot .. $].all!(x => x >= a[pivot]), "RNG seed: %d".format(s));
758757
}
759758
test!"a < b";
760759
static bool myLess(int a, int b)

0 commit comments

Comments
 (0)