Skip to content

Commit 0e17a64

Browse files
authored
Merge pull request #9017 from 0-v-0/master
Remove std.conv import from quickSortImpl
2 parents 0c28620 + d8e8f1f commit 0e17a64

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

std/algorithm/sorting.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,12 +2164,12 @@ private void quickSortImpl(alias less, Range)(Range r, size_t depth)
21642164
{
21652165
import std.algorithm.comparison : min, max;
21662166
import std.algorithm.mutation : swap, swapAt;
2167-
import std.conv : to;
21682167

21692168
alias Elem = ElementType!(Range);
2170-
enum size_t shortSortGetsBetter = max(32, 1024 / Elem.sizeof);
2169+
enum int size = Elem.sizeof;
2170+
enum size_t shortSortGetsBetter = max(32, 1024 / size);
21712171
static assert(shortSortGetsBetter >= 1, Elem.stringof ~ " "
2172-
~ to!string(Elem.sizeof));
2172+
~ size.stringof);
21732173

21742174
// partition
21752175
while (r.length > shortSortGetsBetter)

std/format/internal/read.d

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,16 @@ if (isInputRange!Range && isSomeChar!T && !is(T == enum) && isSomeChar!(ElementT
161161
enforceFmt(find(acceptedSpecs!T, spec.spec).length,
162162
text("Wrong unformat specifier '%", spec.spec , "' for ", T.stringof));
163163

164-
static if (T.sizeof == 1)
164+
enum int size = T.sizeof;
165+
static if (size == 1)
165166
return unformatValue!ubyte(input, spec);
166-
else static if (T.sizeof == 2)
167+
else static if (size == 2)
167168
return unformatValue!ushort(input, spec);
168-
else static if (T.sizeof == 4)
169+
else static if (size == 4)
169170
return unformatValue!uint(input, spec);
170171
else
171172
static assert(false, T.stringof ~ ".sizeof must be 1, 2, or 4 not " ~
172-
to!string(T.sizeof));
173+
size.stringof);
173174
}
174175

175176
T unformatValueImpl(T, Range, Char)(ref Range input, scope const ref FormatSpec!Char fmt)

0 commit comments

Comments
 (0)