From d0b9555a06050c1f6778e7062f17dcb089700775 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Tue, 13 Jun 2017 17:51:52 +0000 Subject: [PATCH] Revert "Sort selective imports" This reverts commit 998ad51fd7e591f07b1202975ae8248b4eaf078a. --- std/algorithm/comparison.d | 6 +-- std/algorithm/internal.d | 4 +- std/algorithm/iteration.d | 4 +- std/algorithm/mutation.d | 10 ++--- std/algorithm/setops.d | 12 +++--- std/algorithm/sorting.d | 16 ++++---- std/array.d | 4 +- std/bigint.d | 6 +-- std/bitmanip.d | 4 +- std/c/freebsd/socket.d | 2 +- std/c/process.d | 2 +- std/complex.d | 10 ++--- std/concurrency.d | 4 +- std/container/array.d | 2 +- std/container/dlist.d | 2 +- std/container/rbtree.d | 4 +- std/container/slist.d | 2 +- std/container/util.d | 2 +- std/conv.d | 10 ++--- std/datetime/date.d | 4 +- std/datetime/interval.d | 2 +- std/datetime/package.d | 2 +- std/datetime/systime.d | 26 ++++++------- std/datetime/timezone.d | 12 +++--- std/digest/digest.d | 4 +- std/digest/hmac.d | 4 +- std/exception.d | 4 +- .../building_blocks/affix_allocator.d | 2 +- .../allocator/building_blocks/free_list.d | 2 +- .../allocator/building_blocks/free_tree.d | 2 +- .../building_blocks/kernighan_ritchie.d | 2 +- .../allocator/building_blocks/region.d | 2 +- std/experimental/allocator/common.d | 4 +- std/experimental/allocator/mallocator.d | 2 +- std/experimental/allocator/package.d | 2 +- std/experimental/allocator/typed.d | 4 +- std/experimental/checkedint.d | 4 +- std/experimental/logger/core.d | 4 +- std/experimental/typecons.d | 2 +- std/file.d | 16 ++++---- std/format.d | 14 +++---- std/functional.d | 2 +- std/getopt.d | 2 +- std/internal/test/dummyrange.d | 2 +- std/json.d | 8 ++-- std/math.d | 2 +- std/meta.d | 2 +- std/net/curl.d | 10 ++--- std/net/isemail.d | 4 +- std/numeric.d | 6 +-- std/parallelism.d | 14 +++---- std/path.d | 20 +++++----- std/process.d | 12 +++--- std/random.d | 2 +- std/range/package.d | 12 +++--- std/range/primitives.d | 2 +- std/regex/internal/backtracking.d | 2 +- std/regex/internal/generator.d | 6 +-- std/regex/internal/tests.d | 2 +- std/regex/package.d | 12 +++--- std/signals.d | 2 +- std/stdio.d | 12 +++--- std/string.d | 38 +++++++++---------- std/uni.d | 20 +++++----- std/utf.d | 2 +- std/uuid.d | 8 ++-- std/variant.d | 4 +- std/windows/registry.d | 4 +- std/windows/syserror.d | 2 +- std/zip.d | 4 +- 70 files changed, 222 insertions(+), 222 deletions(-) diff --git a/std/algorithm/comparison.d b/std/algorithm/comparison.d index 13901b554c1..566b686b16a 100644 --- a/std/algorithm/comparison.d +++ b/std/algorithm/comparison.d @@ -64,7 +64,7 @@ import std.range.primitives; import std.traits; // FIXME import std.meta : allSatisfy; -import std.typecons; // : Flag, Tuple, tuple, Yes; +import std.typecons; // : tuple, Tuple, Flag, Yes; /** Find $(D value) _among $(D values), returning the 1-based index @@ -852,7 +852,7 @@ range of range (of range...) comparisons. @safe unittest { import std.algorithm.comparison : equal; - import std.range : chunks, iota; + import std.range : iota, chunks; assert(equal!(equal!equal)( [[[0, 1], [2, 3]], [[4, 5], [6, 7]]], iota(0, 8).chunks(2).chunks(2) @@ -925,7 +925,7 @@ range of range (of range...) comparisons. @safe pure unittest { - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(equal("æøå".byChar, "æøå")); assert(equal("æøå", "æøå".byChar)); diff --git a/std/algorithm/internal.d b/std/algorithm/internal.d index 5e0cfd68bcb..35ba503e3cc 100644 --- a/std/algorithm/internal.d +++ b/std/algorithm/internal.d @@ -21,7 +21,7 @@ version(unittest) package string[] rndstuff(T : string)() { - import std.random : Random, uniform, unpredictableSeed; + import std.random : Random, unpredictableSeed, uniform; static Random rnd; static bool first = true; @@ -46,7 +46,7 @@ version(unittest) package int[] rndstuff(T : int)() { - import std.random : Random, uniform, unpredictableSeed; + import std.random : Random, unpredictableSeed, uniform; static Random rnd; static bool first = true; diff --git a/std/algorithm/iteration.d b/std/algorithm/iteration.d index 2c4402ade51..74eba6c3447 100644 --- a/std/algorithm/iteration.d +++ b/std/algorithm/iteration.d @@ -2748,7 +2748,7 @@ if (fun.length >= 1) alias binfuns = staticMap!(binaryFun, fun); static if (fun.length > 1) - import std.typecons : isTuple, tuple; + import std.typecons : tuple, isTuple; /++ 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 : max, min; + import std.algorithm.comparison : min, max; import std.typecons : tuple; // Compute minimum and maximum at the same time diff --git a/std/algorithm/mutation.d b/std/algorithm/mutation.d index 23923242122..49f3c850c7f 100644 --- a/std/algorithm/mutation.d +++ b/std/algorithm/mutation.d @@ -78,7 +78,7 @@ T2=$(TR $(TDNW $(LREF $1)) $(TD $+)) module std.algorithm.mutation; import std.range.primitives; -import std.traits : isArray, isBlitAssignable, isNarrowString, isSomeChar, Unqual; +import std.traits : isArray, isBlitAssignable, isNarrowString, Unqual, isSomeChar; // FIXME import std.typecons; // : tuple, Tuple; @@ -279,7 +279,7 @@ Unicode integrity is not preserved: { import std.algorithm.comparison : equal; import std.conv : text; - import std.random : Random, uniform, unpredictableSeed; + import std.random : Random, unpredictableSeed, uniform; // 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 : memcpy, memset; + import core.stdc.string : memset, memcpy; 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 : free, malloc; + import core.stdc.stdlib : malloc, free; struct S { @@ -2835,7 +2835,7 @@ if (isInputRange!Range && hasLvalueElements!Range && is(typeof(range.front = val /// nothrow @system unittest { - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; auto s = (cast(int*) malloc(5 * int.sizeof))[0 .. 5]; uninitializedFill(s, 42); diff --git a/std/algorithm/setops.d b/std/algorithm/setops.d index b9e384b3764..f948cb0635c 100644 --- a/std/algorithm/setops.d +++ b/std/algorithm/setops.d @@ -41,10 +41,10 @@ module std.algorithm.setops; import std.range.primitives; // FIXME -import std.functional; // : binaryFun, unaryFun; +import std.functional; // : unaryFun, binaryFun; import std.traits; // FIXME -import std.meta; // : AliasSeq, allSatisfy, anySatisfy, staticMap; +import std.meta; // : AliasSeq, staticMap, allSatisfy, anySatisfy; import std.algorithm.sorting; // : Merge; import std.typecons : No; @@ -82,13 +82,13 @@ auto cartesianProduct(R1, R2)(R1 range1, R2 range2) if (!allSatisfy!(isForwardRange, R1, R2) || anySatisfy!(isInfinite, R1, R2)) { - import std.algorithm.iteration : joiner, map; + import std.algorithm.iteration : map, joiner; static if (isInfinite!R1 && isInfinite!R2) { static if (isForwardRange!R1 && isForwardRange!R2) { - import std.range : chain, repeat, sequence, take, zip; + import std.range : zip, repeat, take, chain, sequence; // This algorithm traverses the cartesian product by alternately // covering the right and bottom edges of an increasing square area @@ -107,13 +107,13 @@ if (!allSatisfy!(isForwardRange, R1, R2) || } else static if (isInputRange!R1 && isForwardRange!R2 && !isInfinite!R2) { - import std.range : repeat, zip; + import std.range : zip, repeat; return joiner(map!((ElementType!R1 a) => zip(repeat(a), range2.save)) (range1)); } else static if (isInputRange!R2 && isForwardRange!R1 && !isInfinite!R1) { - import std.range : repeat, zip; + import std.range : zip, repeat; return joiner(map!((ElementType!R2 a) => zip(range1.save, repeat(a))) (range2)); } diff --git a/std/algorithm/sorting.d b/std/algorithm/sorting.d index 7cf9e5c41b4..99ac551649e 100644 --- a/std/algorithm/sorting.d +++ b/std/algorithm/sorting.d @@ -116,7 +116,7 @@ void completeSort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable, if (hasLength!(RandomAccessRange2) && hasSlicing!(RandomAccessRange2)) { import std.algorithm.mutation : bringToFront; - import std.range : assumeSorted, chain; + import std.range : chain, assumeSorted; // Probably this algorithm can be optimized by using in-place // merge auto lhsOriginal = lhs.release(); @@ -619,7 +619,7 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range) { assert(pivot < r.length || r.length == 0 && pivot == 0); if (r.length <= 1) return 0; - import std.algorithm.mutation : move, swapAt; + import std.algorithm.mutation : swapAt, move; alias lt = binaryFun!less; // Pivot at the front @@ -1939,7 +1939,7 @@ if (((ss == SwapStrategy.unstable && (hasSwappableElements!Range || { import std.algorithm.internal : rndstuff; import std.algorithm.mutation : swapRanges; - import std.random : Random, uniform, unpredictableSeed; + import std.random : Random, unpredictableSeed, uniform; import std.uni : toUpper; // sort using delegate @@ -2038,7 +2038,7 @@ if (((ss == SwapStrategy.unstable && (hasSwappableElements!Range || private void quickSortImpl(alias less, Range)(Range r, size_t depth) { - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; import std.algorithm.mutation : swap, swapAt; alias Elem = ElementType!(Range); @@ -2736,7 +2736,7 @@ private template TimSortImpl(alias pred, R) @safe unittest { - import std.random : Random, randomShuffle, uniform; + import std.random : Random, uniform, randomShuffle; // Element type with two fields static struct E @@ -2893,7 +2893,7 @@ schwartzSort(alias transform, alias less = "a < b", if (isRandomAccessRange!R && hasLength!R) { import std.conv : emplace; - import std.range : SortedRange, zip; + import std.range : zip, SortedRange; import std.string : representation; alias T = typeof(unaryFun!transform(r.front)); @@ -3437,7 +3437,7 @@ private T[] randomArray(Flag!"exactSize" flag = No.exactSize, T = int)( T minValue = 0, T maxValue = 255) { import std.algorithm.iteration : map; - import std.random : Random, uniform, unpredictableSeed; + import std.random : unpredictableSeed, Random, uniform; auto size = flag == Yes.exactSize ? maxSize : uniform(1, maxSize); return iota(0, size).map!(_ => uniform(minValue, maxValue)).array; } @@ -3698,7 +3698,7 @@ if (isInputRange!(SRange) && isRandomAccessRange!(TRange) @system unittest { - import std.random : Random, randomShuffle, uniform, unpredictableSeed; + import std.random : Random, unpredictableSeed, uniform, randomShuffle; import std.typecons : Yes; auto r = Random(unpredictableSeed); diff --git a/std/array.d b/std/array.d index efbed4606fa..e3d94ad17ae 100644 --- a/std/array.d +++ b/std/array.d @@ -82,7 +82,7 @@ import std.meta; import std.traits; import std.range.primitives; -public import std.range.primitives : back, empty, front, popBack, popFront, save; +public import std.range.primitives : save, empty, popFront, popBack, front, back; /** * Allocates an array and initializes it with copies of the elements @@ -744,7 +744,7 @@ slice, returns that slice. Otherwise, returns the null slice. auto overlap(T, U)(T[] r1, U[] r2) @trusted pure nothrow if (is(typeof(r1.ptr < r2.ptr) == bool)) { - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; auto b = max(r1.ptr, r2.ptr); auto e = min(r1.ptr + r1.length, r2.ptr + r2.length); return b < e ? b[0 .. e - b] : null; diff --git a/std/bigint.d b/std/bigint.d index b24ad5668f5..861df64b1ce 100644 --- a/std/bigint.d +++ b/std/bigint.d @@ -27,7 +27,7 @@ module std.bigint; import std.conv : ConvException; -private import std.format : FormatException, FormatSpec; +private import std.format : FormatSpec, FormatException; private import std.internal.math.biguintcore; private import std.range.primitives; private import std.traits; @@ -674,7 +674,7 @@ public: /// @system unittest { - import std.conv : ConvOverflowException, to; + import std.conv : to, ConvOverflowException; import std.exception : assertThrown; assert(BigInt("0").to!int == 0); @@ -687,7 +687,7 @@ public: @system unittest { - import std.conv : ConvOverflowException, to; + import std.conv : to, ConvOverflowException; import std.exception : assertThrown; assert(BigInt("-1").to!byte == -1); diff --git a/std/bitmanip.d b/std/bitmanip.d index 4bd4f13d645..c38a2a8cec4 100644 --- a/std/bitmanip.d +++ b/std/bitmanip.d @@ -772,7 +772,7 @@ struct BitArray { private: - import core.bitop : bsf, bt, btr, bts; + import core.bitop : bts, btr, bsf, bt; import std.format : FormatSpec; size_t _len; @@ -2052,7 +2052,7 @@ public: */ @property auto bitsSet() const nothrow { - import std.algorithm.iteration : filter, joiner, map; + import std.algorithm.iteration : filter, map, joiner; import std.range : iota; return iota(dim). diff --git a/std/c/freebsd/socket.d b/std/c/freebsd/socket.d index dca4f520f63..35fa4c7810f 100644 --- a/std/c/freebsd/socket.d +++ b/std/c/freebsd/socket.d @@ -14,4 +14,4 @@ public import core.sys.posix.netdb; public import core.sys.posix.netinet.in_ : IPPROTO_IGMP, IPPROTO_GGP, IPPROTO_PUP, IPPROTO_IDP, IPPROTO_ND, IPPROTO_MAX, INADDR_LOOPBACK, INADDR_NONE; -public import core.sys.posix.sys.socket : AF_APPLETALK, AF_IPX, MSG_NOSIGNAL, SOCK_RDM; +public import core.sys.posix.sys.socket : AF_APPLETALK, AF_IPX, SOCK_RDM, MSG_NOSIGNAL; diff --git a/std/c/process.d b/std/c/process.d index 8fcc1929340..14fc729c6c7 100644 --- a/std/c/process.d +++ b/std/c/process.d @@ -13,7 +13,7 @@ deprecated("Import core.stdc.stdlib or the appropriate core.sys.posix.* modules module std.c.process; private import core.stdc.stddef; -public import core.stdc.stdlib : abort, exit, system; +public import core.stdc.stdlib : exit, abort, system; extern (C): diff --git a/std/complex.d b/std/complex.d index e9ad5eb98e7..77638229220 100644 --- a/std/complex.d +++ b/std/complex.d @@ -298,7 +298,7 @@ if (isFloatingPoint!T) Complex!(CommonType!(T, R)) opBinaryRight(string op, R)(R lhs) const if (op == "^^" && isNumeric!R) { - import std.math : cos, exp, log, PI, sin; + import std.math : cos, exp, log, sin, PI; Unqual!(CommonType!(T, R)) ab = void, ar = void; if (lhs >= 0) @@ -370,7 +370,7 @@ if (isFloatingPoint!T) ref Complex opOpAssign(string op, C)(C z) if (op == "^^" && is(C R == Complex!R)) { - import std.math : cos, exp, log, sin; + import std.math : exp, log, cos, sin; immutable r = abs(this); immutable t = arg(this); immutable ab = r^^z.re * exp(-t*z.im); @@ -799,7 +799,7 @@ Complex!T conj(T)(Complex!T z) @safe pure nothrow @nogc Complex!(CommonType!(T, U)) fromPolar(T, U)(T modulus, U argument) @safe pure nothrow @nogc { - import std.math : cos, sin; + import std.math : sin, cos; return Complex!(CommonType!(T,U)) (modulus*cos(argument), modulus*sin(argument)); } @@ -822,7 +822,7 @@ Complex!(CommonType!(T, U)) fromPolar(T, U)(T modulus, U argument) */ Complex!T sin(T)(Complex!T z) @safe pure nothrow @nogc { - import std.math : coshisinh, expi; + import std.math : expi, coshisinh; auto cs = expi(z.re); auto csh = coshisinh(z.im); return typeof(return)(cs.im * csh.re, cs.re * csh.im); @@ -840,7 +840,7 @@ Complex!T sin(T)(Complex!T z) @safe pure nothrow @nogc /// ditto Complex!T cos(T)(Complex!T z) @safe pure nothrow @nogc { - import std.math : coshisinh, expi; + import std.math : expi, coshisinh; auto cs = expi(z.re); auto csh = coshisinh(z.im); return typeof(return)(cs.re * csh.re, - cs.im * csh.im); diff --git a/std/concurrency.d b/std/concurrency.d index b54614208d0..2fbcd308bae 100644 --- a/std/concurrency.d +++ b/std/concurrency.d @@ -2269,7 +2269,7 @@ private version (unittest) { import std.stdio; - import std.typecons : Tuple, tuple; + import std.typecons : tuple, Tuple; void testfn(Tid tid) { @@ -2410,7 +2410,7 @@ auto ref initOnce(alias var)(lazy typeof(var) init, Mutex mutex) // check that var is global, can't take address of a TLS variable static assert(is(typeof({ __gshared p = &var; })), "var must be 'static shared' or '__gshared'."); - import core.atomic : atomicLoad, atomicStore, MemoryOrder; + import core.atomic : atomicLoad, MemoryOrder, atomicStore; static shared bool flag; if (!atomicLoad!(MemoryOrder.acq)(flag)) diff --git a/std/container/array.d b/std/container/array.d index 0cc572389d0..af01deff11e 100644 --- a/std/container/array.d +++ b/std/container/array.d @@ -251,7 +251,7 @@ private struct RangeT(A) struct Array(T) if (!is(Unqual!T == bool)) { - import core.stdc.stdlib : free, malloc, realloc; + import core.stdc.stdlib : malloc, realloc, free; import core.stdc.string : memcpy, memmove, memset; import core.memory : GC; diff --git a/std/container/dlist.d b/std/container/dlist.d index 5caf987a08a..633371fa67f 100644 --- a/std/container/dlist.d +++ b/std/container/dlist.d @@ -39,7 +39,7 @@ module std.container.dlist; // If you want to apply range operations, simply slice it. import std.algorithm.searching : countUntil; - import std.range : popBackN, popFrontN, walkLength; + import std.range : popFrontN, popBackN, walkLength; auto sl = DList!int([1, 2, 3, 4, 5]); assert(countUntil(sl[], 2) == 1); diff --git a/std/container/rbtree.d b/std/container/rbtree.d index 3be1871486e..5342b1692e4 100644 --- a/std/container/rbtree.d +++ b/std/container/rbtree.d @@ -742,7 +742,7 @@ if (is(typeof(binaryFun!less(T.init, T.init)))) import std.meta : allSatisfy; import std.range : Take; import std.range.primitives : isInputRange, walkLength; - import std.traits : isDynamicArray, isImplicitlyConvertible, isIntegral; + import std.traits : isIntegral, isDynamicArray, isImplicitlyConvertible; alias _less = binaryFun!less; @@ -1820,7 +1820,7 @@ assert(equal(rbt[], [5])); test!byte(); } -import std.range.primitives : ElementType, isInputRange, isSomeString; +import std.range.primitives : isInputRange, isSomeString, ElementType; import std.traits : isArray; /++ diff --git a/std/container/slist.d b/std/container/slist.d index b36584e3b55..820b0bbac45 100644 --- a/std/container/slist.d +++ b/std/container/slist.d @@ -57,7 +57,7 @@ struct SList(T) { import std.exception : enforce; import std.range : Take; - import std.range.primitives : ElementType, isForwardRange, isInputRange; + import std.range.primitives : isInputRange, isForwardRange, ElementType; import std.traits : isImplicitlyConvertible; private struct Node diff --git a/std/container/util.d b/std/container/util.d index 1f7aeb3464a..5be9e7d5470 100644 --- a/std/container/util.d +++ b/std/container/util.d @@ -105,7 +105,7 @@ if (is(T == struct) || is(T == class)) template make(alias Container, Args...) if (!is(Container)) { - import std.range : isInfinite, isInputRange; + import std.range : isInputRange, isInfinite; import std.traits : isDynamicArray; auto make(Range)(Range range) diff --git a/std/conv.d b/std/conv.d index 1db8faf1744..85a62cfdc08 100644 --- a/std/conv.d +++ b/std/conv.d @@ -1851,7 +1851,7 @@ if (isInputRange!S && !isInfinite!S && isSomeChar!(ElementEncodingType!S) && // bugzilla 15800 @safe unittest { - import std.utf : byChar, byCodeUnit, byDchar, byWchar; + import std.utf : byCodeUnit, byChar, byWchar, byDchar; assert(to!int(byCodeUnit("10")) == 10); assert(to!int(byCodeUnit("10"), 10) == 10); @@ -2439,7 +2439,7 @@ in } body { - import core.checkedint : addu, mulu; + import core.checkedint : mulu, addu; import std.exception : enforce; if (radix == 10) @@ -2638,7 +2638,7 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum isFloatingPoint!Target && !is(Target == enum)) { import core.stdc.math : HUGE_VAL; - import std.ascii : isAlpha, isDigit, isHexDigit, toLower, toUpper; + import std.ascii : isDigit, isAlpha, toLower, toUpper, isHexDigit; import std.exception : enforce; static if (isNarrowString!Source) @@ -3065,7 +3065,7 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum @safe unittest { import std.exception; - import std.math : fabs, isNaN; + import std.math : isNaN, fabs; // Compare reals with given precision bool feq(in real rx, in real ry, in real precision = 0.000001L) @@ -5814,7 +5814,7 @@ an even number of hexadecimal digits (regardless of the case). private bool isHexLiteral(String)(scope const String hexData) { import std.ascii : isHexDigit; - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; size_t i; foreach (const dchar c; hexData) { diff --git a/std/datetime/date.d b/std/datetime/date.d index 184bc4a058e..a7d33830128 100644 --- a/std/datetime/date.d +++ b/std/datetime/date.d @@ -7281,7 +7281,7 @@ public: if (isSomeString!S) { import std.algorithm.searching : startsWith; - import std.conv : ConvException, text, to; + import std.conv : to, text, ConvException; import std.exception : enforce; import std.string : strip; @@ -8797,7 +8797,7 @@ public: static TimeOfDay fromISOString(S)(in S isoString) @safe pure if (isSomeString!S) { - import std.conv : ConvException, text, to; + import std.conv : to, text, ConvException; import std.exception : enforce; import std.string : strip; diff --git a/std/datetime/interval.d b/std/datetime/interval.d index cf097fd46ac..302b4c28e99 100644 --- a/std/datetime/interval.d +++ b/std/datetime/interval.d @@ -7,7 +7,7 @@ +/ module std.datetime.interval; -import core.time : dur, Duration; +import core.time : Duration, dur; import std.datetime.date : AllowDayOverflow, DateTimeException, daysToDayOfWeek, DayOfWeek, isTimePoint, Month; import std.exception : enforce; diff --git a/std/datetime/package.d b/std/datetime/package.d index 11f8a61502e..976d06ddb79 100644 --- a/std/datetime/package.d +++ b/std/datetime/package.d @@ -118,7 +118,7 @@ public import std.datetime.timezone; import core.exception : AssertError; import std.functional : unaryFun; import std.traits; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; // Verify module example. diff --git a/std/datetime/systime.d b/std/datetime/systime.d index 4a91f419def..46eee5c8325 100644 --- a/std/datetime/systime.d +++ b/std/datetime/systime.d @@ -1758,7 +1758,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs, nsecs, usecs; + import core.time : msecs, usecs, hnsecs, nsecs; import std.datetime.date : DateTime; auto dt = DateTime(1982, 4, 1, 20, 59, 22); @@ -1846,7 +1846,7 @@ public: /// @safe unittest { - import core.time : Duration, hnsecs, msecs, nsecs; + import core.time : Duration, msecs, hnsecs, nsecs; import std.datetime.date : DateTime; auto st = SysTime(DateTime(1982, 4, 1, 20, 59, 22)); @@ -4564,7 +4564,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs; + import core.time : msecs, hnsecs; import std.datetime.date : DateTime; auto st1 = SysTime(DateTime(2010, 1, 1, 11, 23, 12)); @@ -7383,7 +7383,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs, usecs; + import core.time : msecs, usecs, hnsecs; import std.datetime.date : DateTime; assert(SysTime(DateTime(1999, 1, 6, 0, 0, 0)).endOfMonth == @@ -7834,7 +7834,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs; + import core.time : msecs, hnsecs; import std.datetime.date : DateTime; assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOString() == @@ -7966,7 +7966,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs; + import core.time : msecs, hnsecs; import std.datetime.date : DateTime; assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toISOExtString() == @@ -8102,7 +8102,7 @@ public: /// @safe unittest { - import core.time : hnsecs, msecs; + import core.time : msecs, hnsecs; import std.datetime.date : DateTime; assert(SysTime(DateTime(2010, 7, 4, 7, 6, 12)).toSimpleString() == @@ -8247,7 +8247,7 @@ public: static SysTime fromISOString(S)(in S isoString, immutable TimeZone tz = null) @safe if (isSomeString!S) { - import std.algorithm.searching : find, startsWith; + import std.algorithm.searching : startsWith, find; import std.conv : to; import std.string : strip; @@ -8310,7 +8310,7 @@ public: /// @safe unittest { - import core.time : hnsecs, hours, msecs, usecs; + import core.time : hours, msecs, usecs, hnsecs; import std.datetime.date : DateTime; import std.datetime.timezone : SimpleTimeZone, UTC; @@ -8559,7 +8559,7 @@ public: /// @safe unittest { - import core.time : hnsecs, hours, msecs, usecs; + import core.time : hours, msecs, usecs, hnsecs; import std.datetime.date : DateTime; import std.datetime.timezone : SimpleTimeZone, UTC; @@ -8785,7 +8785,7 @@ public: /// @safe unittest { - import core.time : hnsecs, hours, msecs, usecs; + import core.time : hours, msecs, usecs, hnsecs; import std.datetime.date : DateTime; import std.datetime.timezone : SimpleTimeZone, UTC; @@ -9582,8 +9582,8 @@ SysTime parseRFC822DateTime(R)(R value) @safe if (isRandomAccessRange!R && hasSlicing!R && hasLength!R && (is(Unqual!(ElementType!R) == char) || is(Unqual!(ElementType!R) == ubyte))) { - import std.algorithm.searching : all, find; - import std.ascii : isAlpha, isDigit, isPrintable; + import std.algorithm.searching : find, all; + import std.ascii : isDigit, isAlpha, isPrintable; import std.conv : to; import std.functional : not; import std.string : capitalize, format; diff --git a/std/datetime/timezone.d b/std/datetime/timezone.d index a9c7a225a33..0b3bfa74e2d 100644 --- a/std/datetime/timezone.d +++ b/std/datetime/timezone.d @@ -1199,7 +1199,7 @@ private: { long tm_gmtoff(long stdTime) @trusted const nothrow { - import core.stdc.time : gmtime, localtime, tm; + import core.stdc.time : localtime, gmtime, tm; time_t unixTime = stdTimeToUnixTime(stdTime); tm* buf = localtime(&unixTime); @@ -1595,7 +1595,7 @@ package: static immutable(SimpleTimeZone) fromISOString(S)(S isoString) @safe pure if (isSomeString!S) { - import std.algorithm.searching : all, countUntil, startsWith; + import std.algorithm.searching : startsWith, countUntil, all; import std.ascii : isDigit; import std.conv : to; import std.format : format; @@ -1739,7 +1739,7 @@ package: static immutable(SimpleTimeZone) fromISOExtString(S)(S isoExtString) @safe pure if (isSomeString!S) { - import std.algorithm.searching : all, countUntil, startsWith; + import std.algorithm.searching : startsWith, countUntil, all; import std.ascii : isDigit; import std.conv : to; import std.format : format; @@ -1914,11 +1914,11 @@ private: +/ final class PosixTimeZone : TimeZone { - import std.algorithm.searching : canFind, countUntil, startsWith; - import std.file : dirEntries, DirEntry, exists, isDir, isFile, SpanMode; + import std.algorithm.searching : countUntil, canFind, startsWith; + import std.file : isDir, isFile, exists, dirEntries, SpanMode, DirEntry; import std.path : extension; import std.stdio : File; - import std.string : representation, strip; + import std.string : strip, representation; import std.traits : isArray, isSomeChar; public: diff --git a/std/digest/digest.d b/std/digest/digest.d index 00acb9710d7..3e120922828 100644 --- a/std/digest/digest.d +++ b/std/digest/digest.d @@ -413,7 +413,7 @@ if (isDigest!T) package template isDigestibleRange(Range) { import std.digest.md; - import std.range : ElementType, isInputRange; + import std.range : isInputRange, ElementType; enum bool isDigestibleRange = isInputRange!Range && is(typeof( { MD5 ha; //Could use any conformant hash @@ -1136,7 +1136,7 @@ if (isInputRange!R1 && isInputRange!R2 && !isInfinite!R1 && !isInfinite!R2 && import std.internal.test.dummyrange : ReferenceInputRange; import std.range : takeExactly; import std.string : representation; - import std.utf : byDchar, byWchar; + import std.utf : byWchar, byDchar; { auto hex1 = "02CA3484C375EDD3C0F08D3F50D119E61077".representation; diff --git a/std/digest/hmac.d b/std/digest/hmac.d index 7a9d0f3b12b..20d9821488c 100644 --- a/std/digest/hmac.d +++ b/std/digest/hmac.d @@ -16,7 +16,7 @@ Source: $(PHOBOSSRC std/digest/_hmac.d) module std.digest.hmac; -import std.digest.digest : DigestType, hasBlockSize, isDigest, isDigestibleRange; +import std.digest.digest : isDigest, hasBlockSize, isDigestibleRange, DigestType; import std.meta : allSatisfy; /** @@ -286,7 +286,7 @@ if (isDigest!H) version(unittest) { - import std.digest.digest : LetterCase, toHexString; + import std.digest.digest : toHexString, LetterCase; alias hex = toHexString!(LetterCase.lower); } diff --git a/std/exception.d b/std/exception.d index 9c6d9089046..5767e8710a0 100644 --- a/std/exception.d +++ b/std/exception.d @@ -1511,7 +1511,7 @@ class ErrnoException : Exception @system unittest { - import core.stdc.errno : EAGAIN, errno; + import core.stdc.errno : errno, EAGAIN; auto old = errno; scope(exit) errno = old; @@ -2022,7 +2022,7 @@ pure @safe unittest { import std.algorithm.comparison : equal; import std.algorithm.iteration : map, splitter; - import std.conv : ConvException, to; + import std.conv : to, ConvException; auto s = "12,1337z32,54,2,7,9,1z,6,8"; diff --git a/std/experimental/allocator/building_blocks/affix_allocator.d b/std/experimental/allocator/building_blocks/affix_allocator.d index d4d6cc28b6a..cfeae0cdb77 100644 --- a/std/experimental/allocator/building_blocks/affix_allocator.d +++ b/std/experimental/allocator/building_blocks/affix_allocator.d @@ -370,8 +370,8 @@ struct AffixAllocator(Allocator, Prefix, Suffix = void) @system unittest { - import std.experimental.allocator : IAllocator, theAllocator; import std.experimental.allocator.gc_allocator : GCAllocator; + import std.experimental.allocator : theAllocator, IAllocator; // One word before and after each allocation. auto A = AffixAllocator!(IAllocator, size_t, size_t)(theAllocator); diff --git a/std/experimental/allocator/building_blocks/free_list.d b/std/experimental/allocator/building_blocks/free_list.d index 04e33d09a57..ba47f6fc791 100644 --- a/std/experimental/allocator/building_blocks/free_list.d +++ b/std/experimental/allocator/building_blocks/free_list.d @@ -2,7 +2,7 @@ module std.experimental.allocator.building_blocks.free_list; import std.experimental.allocator.common; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; /** diff --git a/std/experimental/allocator/building_blocks/free_tree.d b/std/experimental/allocator/building_blocks/free_tree.d index ad1192b108c..6b64659297e 100644 --- a/std/experimental/allocator/building_blocks/free_tree.d +++ b/std/experimental/allocator/building_blocks/free_tree.d @@ -52,7 +52,7 @@ struct FreeTree(ParentAllocator) static assert(ParentAllocator.alignment % size_t.alignof == 0, "FreeTree must be on top of a word-aligned allocator"); - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; import std.algorithm.mutation : swap; import std.traits : hasMember; diff --git a/std/experimental/allocator/building_blocks/kernighan_ritchie.d b/std/experimental/allocator/building_blocks/kernighan_ritchie.d index 2a810b5775f..38c53848bae 100644 --- a/std/experimental/allocator/building_blocks/kernighan_ritchie.d +++ b/std/experimental/allocator/building_blocks/kernighan_ritchie.d @@ -95,7 +95,7 @@ information is available in client code at deallocation time.) */ struct KRRegion(ParentAllocator = NullAllocator) { - import std.experimental.allocator.common : alignedAt, stateSize; + import std.experimental.allocator.common : stateSize, alignedAt; import std.traits : hasMember; import std.typecons : Ternary; diff --git a/std/experimental/allocator/building_blocks/region.d b/std/experimental/allocator/building_blocks/region.d index 6b1f7726e90..0cc60b9dd58 100644 --- a/std/experimental/allocator/building_blocks/region.d +++ b/std/experimental/allocator/building_blocks/region.d @@ -3,7 +3,7 @@ module std.experimental.allocator.building_blocks.region; import std.experimental.allocator.building_blocks.null_allocator; import std.experimental.allocator.common; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; /** A $(D Region) allocator allocates memory straight from one contiguous chunk. diff --git a/std/experimental/allocator/common.d b/std/experimental/allocator/common.d index 59a58151c9b..0b0bde6a507 100644 --- a/std/experimental/allocator/common.d +++ b/std/experimental/allocator/common.d @@ -425,7 +425,7 @@ version(unittest) { import std.conv : text; import std.math : isPowerOf2; - import std.stdio : stderr, writeln; + import std.stdio : writeln, stderr; import std.typecons : Ternary; alias A = typeof(make()); scope(failure) stderr.writeln("testAllocator failed for ", A.stringof); @@ -551,7 +551,7 @@ version(unittest) { import std.conv : text; import std.math : isPowerOf2; - import std.stdio : stderr, writeln; + import std.stdio : writeln, stderr; import std.typecons : Ternary; scope(failure) stderr.writeln("testAllocatorObject failed for ", AllocInterface.stringof); diff --git a/std/experimental/allocator/mallocator.d b/std/experimental/allocator/mallocator.d index 111ac759c17..5dfdc999966 100644 --- a/std/experimental/allocator/mallocator.d +++ b/std/experimental/allocator/mallocator.d @@ -230,7 +230,7 @@ struct AlignedMallocator @trusted @nogc nothrow void[] alignedAllocate(size_t bytes, uint a) shared { - import core.stdc.errno : EINVAL, ENOMEM; + import core.stdc.errno : ENOMEM, EINVAL; assert(a.isGoodDynamicAlignment); void* result; auto code = posix_memalign(&result, a, bytes); diff --git a/std/experimental/allocator/package.d b/std/experimental/allocator/package.d index 7b4de93474e..1b5367e565b 100644 --- a/std/experimental/allocator/package.d +++ b/std/experimental/allocator/package.d @@ -229,7 +229,7 @@ public import std.experimental.allocator.common, // Example in the synopsis above @system unittest { - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; import std.experimental.allocator.building_blocks.allocator_list : AllocatorList; import std.experimental.allocator.building_blocks.bitmapped_block diff --git a/std/experimental/allocator/typed.d b/std/experimental/allocator/typed.d index 3ba0f3eecce..92828f3879e 100644 --- a/std/experimental/allocator/typed.d +++ b/std/experimental/allocator/typed.d @@ -15,8 +15,8 @@ import std.experimental.allocator; import std.experimental.allocator.common; import std.range : isInputRange, isForwardRange, walkLength, save, empty, front, popFront; -import std.traits : hasElaborateDestructor, isPointer; -import std.typecons : Flag, No, Yes; +import std.traits : isPointer, hasElaborateDestructor; +import std.typecons : Flag, Yes, No; /** Allocation-related flags dictated by type characteristics. `TypedAllocator` diff --git a/std/experimental/checkedint.d b/std/experimental/checkedint.d index d0640cd52a0..96dc4f282cf 100644 --- a/std/experimental/checkedint.d +++ b/std/experimental/checkedint.d @@ -1336,7 +1336,7 @@ struct Throw auto x1 = cast(T) x; assert(x1 == 42); x = T.max + 1; - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; assertThrown(cast(T) x); x = x.max; assertThrown(x += 42); @@ -2277,7 +2277,7 @@ if (isIntegral!L && isIntegral!R) else alias Result = typeof(mixin("L() " ~ x ~ " R()")); - import core.checkedint : adds, addu, muls, mulu, subs, subu; + import core.checkedint : addu, adds, subs, muls, subu, mulu; import std.algorithm.comparison : among; static if (x == "==") { diff --git a/std/experimental/logger/core.d b/std/experimental/logger/core.d index d150cf5934d..c794d19461a 100644 --- a/std/experimental/logger/core.d +++ b/std/experimental/logger/core.d @@ -627,7 +627,7 @@ alias fatalf = defaultLogFunctionf!(LogLevel.fatal); private struct MsgRange { - import std.traits : isSomeChar, isSomeString; + import std.traits : isSomeString, isSomeChar; private Logger log; @@ -1939,7 +1939,7 @@ version(unittest) private void testFuncNames(Logger logger) @safe @safe unittest { import std.conv : to; - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; import std.format : format; auto l = new TestLogger(LogLevel.all); diff --git a/std/experimental/typecons.d b/std/experimental/typecons.d index 5a41567d636..1d92d614d2b 100644 --- a/std/experimental/typecons.d +++ b/std/experimental/typecons.d @@ -512,7 +512,7 @@ version(StdDdoc) /// @system unittest { - import std.traits : FunctionAttribute, functionAttributes; + import std.traits : functionAttributes, FunctionAttribute; interface A { int run(); } interface B { int stop(); @property int status(); } class X diff --git a/std/file.d b/std/file.d index d74de74a8e7..1fff42df695 100644 --- a/std/file.d +++ b/std/file.d @@ -741,7 +741,7 @@ private void renameImpl(const(char)[] f, const(char)[] t, const(FSChar)* fromz, if (!result) { import core.stdc.wchar_ : wcslen; - import std.conv : text, to; + import std.conv : to, text; if (!f) f = to!(typeof(f))(fromz[0 .. wcslen(fromz)]); @@ -2321,7 +2321,7 @@ private bool ensureDirExists()(in char[] pathname) void mkdirRecurse(in char[] pathname) @safe { - import std.path : baseName, dirName; + import std.path : dirName, baseName; const left = dirName(pathname); if (left.length != pathname.length && !exists(left)) @@ -2338,7 +2338,7 @@ void mkdirRecurse(in char[] pathname) @safe { import std.exception : assertThrown; { - import std.path : buildNormalizedPath, buildPath; + import std.path : buildPath, buildNormalizedPath; immutable basepath = deleteme ~ "_dir"; scope(exit) () @trusted { rmdirRecurse(basepath); }(); @@ -2748,7 +2748,7 @@ else version (NetBSD) } else version (FreeBSD) { - import std.exception : assumeUnique, errnoEnforce; + import std.exception : errnoEnforce, assumeUnique; enum { CTL_KERN = 1, @@ -3436,7 +3436,7 @@ private void copyImpl(const(char)[] f, const(char)[] t, const(FSChar)* fromz, co else version(Posix) { static import core.stdc.stdio; - import std.conv : octal, to; + import std.conv : to, octal; immutable fdr = core.sys.posix.fcntl.open(fromz, O_RDONLY); cenforce(fdr != -1, f, fromz); @@ -3609,7 +3609,7 @@ version(Windows) @system unittest version(Posix) @system unittest { - import std.exception : collectException, enforce; + import std.exception : enforce, collectException; import std.process : executeShell; collectException(rmdirRecurse(deleteme)); auto d = deleteme~"/a/b/c/d/e/f/g"; @@ -3997,7 +3997,7 @@ auto dirEntries(string path, SpanMode mode, bool followSymlink = true) import std.algorithm.searching : startsWith; import std.array : array; import std.conv : to; - import std.path : absolutePath, buildPath, dirEntries; + import std.path : dirEntries, buildPath, absolutePath; import std.process : thisProcessID; import std.range.primitives : walkLength; @@ -4091,7 +4091,7 @@ auto dirEntries(string path, string pattern, SpanMode mode, bool followSymlink = true) { import std.algorithm.iteration : filter; - import std.path : baseName, globMatch; + import std.path : globMatch, baseName; bool f(DirEntry de) { return globMatch(baseName(de.name), pattern); } return filter!f(DirIterator(path, mode, followSymlink)); diff --git a/std/format.d b/std/format.d index 04c043db20a..e155372fc77 100644 --- a/std/format.d +++ b/std/format.d @@ -1004,7 +1004,7 @@ struct FormatSpec(Char) if (is(Unqual!Char == Char)) { import std.algorithm.searching : startsWith; - import std.ascii : isAlpha, isDigit, isPunctuation; + import std.ascii : isDigit, isPunctuation, isAlpha; import std.conv : parse, text, to; /** @@ -2165,7 +2165,7 @@ if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char)) version (CRuntime_Microsoft) { - import std.math : isInfinity, isNaN; + import std.math : isNaN, isInfinity; immutable double tval = val; // convert early to get "inf" in case of overflow string s; if (isNaN(tval)) @@ -3653,7 +3653,7 @@ if (is(T == interface) && (hasToString!(T, Char) || !is(BuiltinTypeOf!T)) && !is // Issue 11175 version (Windows) { - import core.sys.windows.com : IID, IUnknown; + import core.sys.windows.com : IUnknown, IID; import core.sys.windows.windows : HRESULT; interface IUnknown2 : IUnknown { } @@ -4250,7 +4250,7 @@ void formatTest(T)(string fmt, T val, string[] expected, size_t ln = __LINE__, s { import core.stdc.string : strlen; import std.array : appender; - import std.conv : octal, text; + import std.conv : text, octal; import std.c.stdio : snprintf; debug(format) printf("std.format.format.unittest\n"); @@ -5072,7 +5072,7 @@ private T unformatValueImpl(T, Range, Char)(ref Range input, const ref FormatSpe if (isInputRange!Range && isSomeChar!T && !is(T == enum) && isSomeChar!(ElementType!Range)) { import std.algorithm.searching : find; - import std.conv : text, to; + import std.conv : to, text; if (spec.spec == 's' || spec.spec == 'c') { auto result = to!T(input.front); @@ -5798,7 +5798,7 @@ immutable(Char)[] format(Char, Args...)(in Char[] fmt, Args args) if (isSomeChar!Char) { import std.array : appender; - import std.format : FormatException, formattedWrite; + import std.format : formattedWrite, FormatException; auto w = appender!(immutable(Char)[]); auto n = formattedWrite(w, fmt, args); version (all) @@ -5874,7 +5874,7 @@ if (isSomeString!(typeof(fmt))) char[] sformat(Char, Args...)(char[] buf, in Char[] fmt, Args args) { import core.exception : RangeError; - import std.format : FormatException, formattedWrite; + import std.format : formattedWrite, FormatException; import std.utf : encode; size_t i; diff --git a/std/functional.d b/std/functional.d index 44c9bb868d2..128c89c5807 100644 --- a/std/functional.d +++ b/std/functional.d @@ -259,7 +259,7 @@ template binaryFun(alias fun, string parm1Name = "a", private uint _ctfeSkipOp(ref string op) { if (!__ctfe) assert(false); - import std.ascii : isAlphaNum, isASCII; + import std.ascii : isASCII, isAlphaNum; immutable oldLength = op.length; while (op.length) { diff --git a/std/getopt.d b/std/getopt.d index 66194645bb9..890a3c3f233 100644 --- a/std/getopt.d +++ b/std/getopt.d @@ -1614,7 +1614,7 @@ Params: */ void defaultGetoptFormatter(Output)(Output output, string text, Option[] opt) { - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; import std.format : formattedWrite; output.formattedWrite("%s\n", text); diff --git a/std/internal/test/dummyrange.d b/std/internal/test/dummyrange.d index d7191bdf064..a6bce0ada23 100644 --- a/std/internal/test/dummyrange.d +++ b/std/internal/test/dummyrange.d @@ -420,7 +420,7 @@ if (is(T == TestFoo)) @system unittest { import std.algorithm.comparison : equal; - import std.range : iota, repeat, retro; + import std.range : iota, retro, repeat; import std.traits : Unqual; static void testInputRange(T,Cmp)() diff --git a/std/json.d b/std/json.d index 14975e4ce72..008870aa341 100644 --- a/std/json.d +++ b/std/json.d @@ -100,7 +100,7 @@ JSON value node */ struct JSONValue { - import std.exception : enforce, enforceEx; + import std.exception : enforceEx, enforce; union Store { @@ -702,7 +702,7 @@ Params: JSONValue parseJSON(T)(T json, int maxDepth = -1, JSONOptions options = JSONOptions.none) if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T)) { - import std.ascii : isDigit, isHexDigit, isWhite, toLower, toUpper; + import std.ascii : isWhite, isDigit, isHexDigit, toUpper, toLower; import std.typecons : Yes; import std.utf : encode; @@ -1224,7 +1224,7 @@ string toJSON(const ref JSONValue root, in bool pretty = false, in JSONOptions o break; case JSON_TYPE.FLOAT: - import std.math : isInfinity, isNaN; + import std.math : isNaN, isInfinity; auto val = value.store.floating; @@ -1638,7 +1638,7 @@ EOF"; @safe unittest { import std.exception : assertThrown; - import std.math : isInfinity, isNaN; + import std.math : isNaN, isInfinity; // expected representations of NaN and Inf enum { diff --git a/std/math.d b/std/math.d index ed8abf8ad15..43c18187f5d 100644 --- a/std/math.d +++ b/std/math.d @@ -686,7 +686,7 @@ float sin(float x) @safe pure nothrow @nogc { return sin(cast(real) x); } /// @safe unittest { - import std.math : PI, sin; + import std.math : sin, PI; import std.stdio : writefln; void someFunc() diff --git a/std/meta.d b/std/meta.d index 6a4d87b9345..77ed211d6e0 100644 --- a/std/meta.d +++ b/std/meta.d @@ -1164,7 +1164,7 @@ template aliasSeqOf(alias range) @safe unittest { - import std.conv : octal, to; + import std.conv : to, octal; import std.range : iota; //Testing compile time octal foreach (I2; aliasSeqOf!(iota(0, 8))) diff --git a/std/net/curl.d b/std/net/curl.d index a7fe0d3a9f7..e8212735363 100644 --- a/std/net/curl.d +++ b/std/net/curl.d @@ -238,7 +238,7 @@ version(unittest) private Request!T recvReq(T=char)(Socket s) { import std.algorithm.comparison : min; - import std.algorithm.searching : canFind, find; + import std.algorithm.searching : find, canFind; import std.conv : to; import std.regex : ctRegex, matchFirst; @@ -1287,7 +1287,7 @@ if (isCurlConn!Conn && isSomeChar!Char && isSomeChar!Terminator) void popFront() { - import std.algorithm.searching : findSplit, findSplitAfter; + import std.algorithm.searching : findSplitAfter, findSplit; enforce!CurlException(currentValid, "Cannot call popFront() on empty range"); if (lines.empty) @@ -2417,7 +2417,7 @@ struct HTTP { import std.algorithm.searching : startsWith; import std.conv : to; - import std.regex : match, regex; + import std.regex : regex, match; import std.uni : toLower; // Wrap incoming callback in order to separate http status line from @@ -4061,7 +4061,7 @@ class CurlTimeoutException : CurlException /// Equal to $(REF CURLcode, etc,c,curl) alias CurlCode = CURLcode; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; /// Flag to specify whether or not an exception is thrown on error. alias ThrowOnError = Flag!"throwOnError"; @@ -4099,7 +4099,7 @@ private struct CurlAPI { version (Posix) { - import core.sys.posix.dlfcn : dlclose, dlopen, dlsym, RTLD_LAZY; + import core.sys.posix.dlfcn : dlsym, dlopen, dlclose, RTLD_LAZY; alias loadSym = dlsym; } else version (Windows) diff --git a/std/net/isemail.d b/std/net/isemail.d index 3998917a50b..d37093db375 100644 --- a/std/net/isemail.d +++ b/std/net/isemail.d @@ -28,7 +28,7 @@ module std.net.isemail; import std.range.primitives; // : ElementType; import std.regex; import std.traits; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; /** * Check that an email address conforms to RFCs 5321, 5322 and others. @@ -62,7 +62,7 @@ EmailStatus isEmail(Char)(const(Char)[] email, CheckDns checkDNS = No.checkDns, EmailStatusCode errorLevel = EmailStatusCode.none) if (isSomeChar!(Char)) { - import std.algorithm.iteration : filter, map, uniq; + import std.algorithm.iteration : uniq, filter, map; import std.algorithm.searching : canFind, maxElement; import std.array : array, split; import std.conv : to; diff --git a/std/numeric.d b/std/numeric.d index 508f64f88a5..da287290f68 100644 --- a/std/numeric.d +++ b/std/numeric.d @@ -128,7 +128,7 @@ if (((flags & flags.signed) + precision + exponentWidth) % 8 == 0 && precision + /// @safe unittest { - import std.math : cos, sin; + import std.math : sin, cos; // Define a 16-bit floating point values CustomFloat!16 x; // Using the number of bits @@ -2188,7 +2188,7 @@ if (isRandomAccessRange!(R1) && hasLength!(R1) && isRandomAccessRange!(R2) && hasLength!(R2)) { import core.exception : onOutOfMemoryError; - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; import std.algorithm.mutation : swap; import std.functional : binaryFun; @@ -2316,7 +2316,7 @@ optimizations. struct GapWeightedSimilarityIncremental(Range, F = double) if (isRandomAccessRange!(Range) && hasLength!(Range)) { - import core.stdc.stdlib : alloca, free, malloc, realloc; + import core.stdc.stdlib : malloc, realloc, alloca, free; private: Range s, t; diff --git a/std/parallelism.d b/std/parallelism.d index 42b87c74e10..51d322172d0 100644 --- a/std/parallelism.d +++ b/std/parallelism.d @@ -105,7 +105,7 @@ version(Windows) // BUGS: Only works on Windows 2000 and above. shared static this() { - import core.sys.windows.windows : GetSystemInfo, SYSTEM_INFO; + import core.sys.windows.windows : SYSTEM_INFO, GetSystemInfo; import std.algorithm.comparison : max; SYSTEM_INFO si; @@ -118,7 +118,7 @@ else version(linux) { shared static this() { - import core.sys.posix.unistd : sysconf, _SC_NPROCESSORS_ONLN; + import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN); } } @@ -126,7 +126,7 @@ else version(Solaris) { shared static this() { - import core.sys.posix.unistd : sysconf, _SC_NPROCESSORS_ONLN; + import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf; totalCPUs = cast(uint) sysconf(_SC_NPROCESSORS_ONLN); } } @@ -2625,7 +2625,7 @@ public: byte[maxStack] buf = void; immutable size_t nBytesNeeded = nWorkUnits * RTask.sizeof; - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; if (nBytesNeeded < maxStack) { tasks = (cast(RTask*) buf.ptr)[0 .. nWorkUnits]; @@ -3372,7 +3372,7 @@ private void submitAndExecute( immutable nThreads = pool.size + 1; alias PTask = typeof(scopedTask(doIt)); - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; import core.stdc.string : memcpy; // The logical thing to do would be to just use alloca() here, but that @@ -3931,12 +3931,12 @@ version(unittest) // These are the tests that should be run every time Phobos is compiled. @system unittest { - import std.algorithm.comparison : equal, max, min; + import std.algorithm.comparison : equal, min, max; import std.algorithm.iteration : filter, map, reduce; import std.array : split; import std.conv : text; import std.exception : assertThrown; - import std.math : approxEqual, log, sqrt; + import std.math : approxEqual, sqrt, log; import std.range : indexed, iota, join; import std.typecons : Tuple, tuple; diff --git a/std/path.d b/std/path.d index 9b3049fe181..a9f0bd8015d 100644 --- a/std/path.d +++ b/std/path.d @@ -641,7 +641,7 @@ if (isRandomAccessRange!R && hasSlicing!R && hasLength!R && isSomeChar!(ElementT static assert(dirName("dir/file") == "dir"); import std.array; - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(dirName("".byChar).array == "."); assert(dirName("file"w.byWchar).array == "."w); @@ -1075,7 +1075,7 @@ if (isConvertibleToString!R) assert(stripExtension("file.ext1.ext2"d) == "file.ext1"); import std.array; - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(stripExtension("file".byChar).array == "file"); assert(stripExtension("file.ext"w.byWchar).array == "file"); @@ -1187,7 +1187,7 @@ if ((isRandomAccessRange!R && hasSlicing!R && hasLength!R && isSomeChar!(Element !isConvertibleToString!R && isSomeChar!C) { - import std.range : chain, only; + import std.range : only, chain; import std.utf : byUTF; alias CR = Unqual!(ElementEncodingType!R); @@ -1279,7 +1279,7 @@ if ((isRandomAccessRange!R && hasSlicing!R && hasLength!R && isSomeChar!(Element !isConvertibleToString!R && isSomeChar!C) { - import std.range : chain, only; + import std.range : only, chain; import std.utf : byUTF; alias CR = Unqual!(ElementEncodingType!R); @@ -1539,7 +1539,7 @@ if ((isRandomAccessRange!R1 && hasSlicing!R1 && hasLength!R1 && isSomeChar!(Elem } else { - import std.range : chain, only; + import std.range : only, chain; import std.utf : byUTF; alias CR = Unqual!(ElementEncodingType!R1); @@ -2906,9 +2906,9 @@ if ((isNarrowString!R1 || import std.algorithm.comparison : mismatch; import std.algorithm.iteration : joiner; import std.array : array; - import std.range : chain, choose, repeat; import std.range.primitives : walkLength; - import std.utf : byChar, byCodeUnit; + import std.range : repeat, chain, choose; + import std.utf : byCodeUnit, byChar; // Remove matching prefix from basePS and pathPS auto tup = mismatch!((a, b) => filenameCmp!cs(a, b) == 0)(basePS, pathPS); @@ -3850,8 +3850,8 @@ string expandTilde(string inputPath) nothrow version(Posix) { import core.exception : onOutOfMemoryError; - import core.stdc.errno : ERANGE, errno; - import core.stdc.stdlib : free, malloc, realloc; + import core.stdc.errno : errno, ERANGE; + import core.stdc.stdlib : malloc, free, realloc; /* Joins a path from a C string to the remainder of path. @@ -3913,7 +3913,7 @@ string expandTilde(string inputPath) nothrow } else { - import core.sys.posix.pwd : getpwnam_r, passwd; + import core.sys.posix.pwd : passwd, getpwnam_r; import std.string : indexOf; assert(path.length > 2 || (path.length == 2 && !isDirSeparator(path[1]))); diff --git a/std/process.d b/std/process.d index a2b39ab2ac4..87feb4e1a23 100644 --- a/std/process.d +++ b/std/process.d @@ -386,7 +386,7 @@ private Pid spawnProcessImpl(in char[][] args, scope(exit) if (workDirFD >= 0) close(workDirFD); if (workDir.length) { - import core.sys.posix.fcntl : fstat, open, O_RDONLY, stat_t, S_ISDIR; + import core.sys.posix.fcntl : open, O_RDONLY, stat_t, fstat, S_ISDIR; workDirFD = open(workDir.tempCString(), O_RDONLY); if (workDirFD < 0) throw ProcessException.newFromErrno("Failed to open working directory"); @@ -449,8 +449,8 @@ private Pid spawnProcessImpl(in char[][] args, if (!(config & Config.inheritFDs)) { import core.stdc.stdlib : malloc; - import core.sys.posix.poll : poll, pollfd, POLLNVAL; - import core.sys.posix.sys.resource : getrlimit, rlimit, RLIMIT_NOFILE; + import core.sys.posix.poll : pollfd, poll, POLLNVAL; + import core.sys.posix.sys.resource : rlimit, getrlimit, RLIMIT_NOFILE; // Get the maximum number of file descriptors that could be open. rlimit r; @@ -778,7 +778,7 @@ version (Posix) @safe unittest version (Posix) private void setCLOEXEC(int fd, bool on) nothrow @nogc { - import core.sys.posix.fcntl : fcntl, FD_CLOEXEC, F_GETFD, F_SETFD; + import core.sys.posix.fcntl : fcntl, F_GETFD, FD_CLOEXEC, F_SETFD; auto flags = fcntl(fd, F_GETFD); if (flags >= 0) { @@ -1590,7 +1590,7 @@ void kill(Pid pid, int codeOrSignal) } else version (Posix) { - import core.sys.posix.signal : SIGKILL, SIGTERM; + import core.sys.posix.signal : SIGTERM, SIGKILL; TestScript prog = "while true; do sleep 1; done"; } auto pid = spawnProcess(prog.path); @@ -2491,7 +2491,7 @@ private struct TestScript ~this() { - import std.file : exists, remove; + import std.file : remove, exists; if (!path.empty && exists(path)) { try { remove(path); } diff --git a/std/random.d b/std/random.d index 9cf7469c401..20f88b1be5d 100644 --- a/std/random.d +++ b/std/random.d @@ -1287,7 +1287,7 @@ A single unsigned integer seed value, different on each successive call */ @property uint unpredictableSeed() @trusted { - import core.thread : getpid, MonoTime, Thread; + import core.thread : Thread, getpid, MonoTime; static bool seeded; static MinstdRand0 rand; if (!seeded) diff --git a/std/range/package.d b/std/range/package.d index 6da8f9d90a6..27e1e9c3c5f 100644 --- a/std/range/package.d +++ b/std/range/package.d @@ -230,7 +230,7 @@ module std.range; public import std.array; public import std.range.interfaces; public import std.range.primitives; -public import std.typecons : Flag, No, Yes; +public import std.typecons : Flag, Yes, No; import std.meta; // allSatisfy, staticMap import std.traits; // CommonType, isCallable, isFloatingPoint, isIntegral, @@ -4197,7 +4197,7 @@ if (Ranges.length && allSatisfy!(isInputRange, Ranges)) return ranges[0].length; //[min|max](ranges[0].length, ranges[1].length, ...) - import std.algorithm.comparison : max, min; + import std.algorithm.comparison : min, max; if (stoppingPolicy == StoppingPolicy.shortest) return mixin(q{min(%(ranges[%s].length%|, %))}.format(iota(0, R.length))); else @@ -4360,7 +4360,7 @@ enum StoppingPolicy import std.algorithm.mutation : swap; import std.algorithm.sorting : sort; - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; import std.typecons : tuple; int[] a = [ 1, 2, 3 ]; @@ -5593,7 +5593,7 @@ debug @system unittest { import std.algorithm.comparison : equal; import std.algorithm.searching : count; - import std.math : approxEqual, nextDown, nextUp; + import std.math : approxEqual, nextUp, nextDown; import std.meta : AliasSeq; static assert(is(ElementType!(typeof(iota(0f))) == float)); @@ -8170,7 +8170,7 @@ public: @safe pure nothrow unittest { import std.algorithm.comparison : equal; - import std.internal.test.dummyrange : AllDummyRanges, DummyRange, Length, RangeType, ReturnBy; + import std.internal.test.dummyrange : DummyRange, Length, RangeType, ReturnBy, AllDummyRanges; import std.meta : AliasSeq; alias AllForwardDummyRanges = AliasSeq!( @@ -10729,7 +10729,7 @@ if (isInputRange!R && is(R == class)) @safe unittest // bug 9060 { - import std.algorithm.iteration : group, joiner, map; + import std.algorithm.iteration : map, joiner, group; import std.algorithm.searching : until; // fix for std.algorithm auto r = map!(x => 0)([1]); diff --git a/std/range/primitives.d b/std/range/primitives.d index 2c4201bfc77..e4931fdf897 100644 --- a/std/range/primitives.d +++ b/std/range/primitives.d @@ -1364,7 +1364,7 @@ template hasLvalueElements(R) /// @safe unittest { - import std.range : chain, iota; + import std.range : iota, chain; static assert( hasLvalueElements!(int[])); static assert( hasLvalueElements!(const(int)[])); diff --git a/std/regex/internal/backtracking.d b/std/regex/internal/backtracking.d index 71ea9723823..ffc9779923a 100644 --- a/std/regex/internal/backtracking.d +++ b/std/regex/internal/backtracking.d @@ -799,7 +799,7 @@ alias Sequence(int B, int E) = staticIota!(B, E); struct CtContext { - import std.conv : text, to; + import std.conv : to, text; //dirty flags bool counter; //to mark the portion of matches to save diff --git a/std/regex/internal/generator.d b/std/regex/internal/generator.d index 8a51c58a20d..6831e59ed2e 100644 --- a/std/regex/internal/generator.d +++ b/std/regex/internal/generator.d @@ -12,11 +12,11 @@ module std.regex.internal.generator; */ @trusted private struct SampleGenerator(Char) { - import std.array : Appender, appender; + import std.array : appender, Appender; import std.format : formattedWrite; import std.random : Xorshift; - import std.regex.internal.ir : IR, IRL, Regex; - import std.utf : byChar, isValidDchar; + import std.regex.internal.ir : Regex, IR, IRL; + import std.utf : isValidDchar, byChar; Regex!Char re; Appender!(char[]) app; uint limit, seed; diff --git a/std/regex/internal/tests.d b/std/regex/internal/tests.d index 46f972d828e..80e278bf648 100644 --- a/std/regex/internal/tests.d +++ b/std/regex/internal/tests.d @@ -1015,7 +1015,7 @@ alias Sequence(int B, int E) = staticIota!(B, E); @safe unittest { import std.array : appender; - import std.regex : regex, replaceFirst, replaceFirstInto; + import std.regex : replaceFirst, replaceFirstInto, regex; import std.stdio : writeln; auto example = "Hello, world!"; diff --git a/std/regex/package.d b/std/regex/package.d index f1d7f8763c5..3b7c4e7c2a8 100644 --- a/std/regex/package.d +++ b/std/regex/package.d @@ -299,7 +299,7 @@ module std.regex; import std.range.primitives, std.traits; import std.regex.internal.ir; import std.regex.internal.thompson; //TODO: get rid of this dependency -import std.typecons; // : Flag, No, Yes; +import std.typecons; // : Flag, Yes, No; /++ $(D Regex) object holds regular expression pattern in compiled form. @@ -409,7 +409,7 @@ if (isSomeString!(S)) public auto regexImpl(S)(S pattern, const(char)[] flags="") if (isSomeString!(S)) { - import std.regex.internal.parser : CodeGen, Parser; + import std.regex.internal.parser : Parser, CodeGen; auto parser = Parser!(Unqual!(typeof(pattern)), CodeGen)(pattern, flags); auto r = parser.program; return r; @@ -692,7 +692,7 @@ public: if (isSomeString!R) { private: - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; alias Char = BasicElementOf!R; alias EngineType = Engine!Char; EngineType _engine; @@ -810,7 +810,7 @@ public: private @trusted auto matchOnce(alias Engine, RegEx, R)(R input, RegEx re) { - import core.stdc.stdlib : free, malloc; + import core.stdc.stdlib : malloc, free; import std.exception : enforce; alias Char = BasicElementOf!R; alias EngineType = Engine!Char; @@ -1138,8 +1138,8 @@ if (isOutputRange!(OutR, ElementEncodingType!R[]) && isOutputRange!(OutR, ElementEncodingType!(Capt.String)[])) { import std.algorithm.searching : find; - import std.ascii : isAlpha, isDigit; - import std.conv : parse, text; + import std.ascii : isDigit, isAlpha; + import std.conv : text, parse; import std.exception : enforce; enum State { Normal, Dollar } auto state = State.Normal; diff --git a/std/signals.d b/std/signals.d index ec9c1af1fcb..4f4d81d409a 100644 --- a/std/signals.d +++ b/std/signals.d @@ -63,7 +63,7 @@ module std.signals; import core.exception : onOutOfMemoryError; -import core.stdc.stdlib : calloc, free, realloc; +import core.stdc.stdlib : calloc, realloc, free; import std.stdio; // Special function for internal use only. diff --git a/std/stdio.d b/std/stdio.d index 09e1126af6e..1464445fd7f 100644 --- a/std/stdio.d +++ b/std/stdio.d @@ -350,7 +350,7 @@ Hello, Jimmy! struct File { import std.range.primitives : ElementEncodingType; - import std.traits : isArray, isScalarType; + import std.traits : isScalarType, isArray; enum Orientation { unknown, narrow, wide } private struct Impl @@ -525,7 +525,7 @@ Throws: $(D ErrnoException) in case of error. @system unittest // Test changing filename { - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; static import std.file; auto deleteme = testFilename(); @@ -547,7 +547,7 @@ Throws: $(D ErrnoException) in case of error. version (CRuntime_Microsoft) {} else // Not implemented @system unittest // Test changing mode { - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; static import std.file; auto deleteme = testFilename(); @@ -1003,7 +1003,7 @@ Throws: $(D Exception) if the file is not opened. */ void seek(long offset, int origin = SEEK_SET) @trusted { - import std.conv : text, to; + import std.conv : to, text; import std.exception : enforce, errnoEnforce; enforce(isOpen, "Attempting to seek() in an unopened file"); @@ -1152,7 +1152,7 @@ Throws: $(D Exception) if the file is not opened. version(Windows) { - import core.sys.windows.windows : BOOL, OVERLAPPED, ULARGE_INTEGER; + import core.sys.windows.windows : ULARGE_INTEGER, OVERLAPPED, BOOL; private BOOL lockImpl(alias F, Flags...)(ulong start, ulong length, Flags flags) @@ -1395,7 +1395,7 @@ Throws: $(D Exception) if the file is not opened. */ void write(S...)(S args) { - import std.traits : isAggregateType, isBoolean, isIntegral; + import std.traits : isBoolean, isIntegral, isAggregateType; auto w = lockingTextWriter(); foreach (arg; args) { diff --git a/std/string.d b/std/string.d index 1d2adaed1a0..2635a78f521 100644 --- a/std/string.d +++ b/std/string.d @@ -186,7 +186,7 @@ private: } public import std.format : format, sformat; -import std.typecons : Flag, No, Yes; +import std.typecons : Flag, Yes, No; public import std.uni : icmp, toLower, toLowerInPlace, toUpper, toUpperInPlace; import std.meta; // AliasSeq, staticIndexOf @@ -199,8 +199,8 @@ import std.traits; // isConvertibleToString, isNarrowString, isSomeChar, //public imports for backward compatibility public import std.algorithm.comparison : cmp; -public import std.algorithm.searching : count, endsWith, startsWith; -public import std.array : empty, join, replace, replaceInPlace, split; +public import std.algorithm.searching : startsWith, endsWith, count; +public import std.array : join, replace, replaceInPlace, split, empty; /* ************* Exceptions *************** */ @@ -257,7 +257,7 @@ inout(char)[] fromStringz(inout(char)* cString) @nogc @system pure nothrow { immutable(char)* toStringz(const(char)[] s) @trusted pure nothrow out (result) { - import core.stdc.string : memcmp, strlen; + import core.stdc.string : strlen, memcmp; if (result) { auto slen = s.length; @@ -378,7 +378,7 @@ if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && { static import std.ascii; static import std.uni; - import std.utf : byCodeUnit, byDchar, codeLength, UTFException; + import std.utf : byDchar, byCodeUnit, UTFException, codeLength; alias Char = Unqual!(ElementEncodingType!Range); if (cs == Yes.caseSensitive) @@ -579,7 +579,7 @@ if (isConvertibleToString!Range) import std.conv : to; import std.exception : assertCTFEable; import std.traits : EnumMembers; - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; debug(string) trustedPrintf("string.indexOf.unittest\n"); assertCTFEable!( @@ -635,7 +635,7 @@ if (isConvertibleToString!Range) { import std.conv : to; import std.traits : EnumMembers; - import std.utf : byChar, byCodeUnit, byWchar; + import std.utf : byCodeUnit, byChar, byWchar; debug(string) trustedPrintf("string.indexOf(startIdx).unittest\n"); assert("hello".byCodeUnit.indexOf(cast(dchar)'l', 1) == 2); @@ -3214,7 +3214,7 @@ if ((isRandomAccessRange!Range && isSomeChar!(ElementEncodingType!Range) || isNarrowString!Range) && !isConvertibleToString!Range) { - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; if (str.empty) return str; @@ -3308,7 +3308,7 @@ if ((isBidirectionalRange!Range && isSomeChar!(ElementEncodingType!Range) || @safe pure unittest { - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; import std.utf : decode; assert(chomp(" hello world \n\r") == " hello world \n"); assert(chomp(" hello world \r\n") == " hello world "); @@ -3396,7 +3396,7 @@ if (isConvertibleToString!Range) // Ranges import std.array : array; - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(chomp("hello world\r\n" .byChar ).array == "hello world"); assert(chomp("hello world\r\n"w.byWchar).array == "hello world"w); assert(chomp("hello world\r\n"d.byDchar).array == "hello world"d); @@ -3496,7 +3496,7 @@ unittest // Ranges import std.array : array; - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(chompPrefix("hello world" .byChar , "hello"d).array == " world"); assert(chompPrefix("hello world"w.byWchar, "hello" ).array == " world"w); assert(chompPrefix("hello world"d.byDchar, "hello"w).array == " world"d); @@ -3608,7 +3608,7 @@ if (isConvertibleToString!Range) @safe pure unittest { import std.array : array; - import std.utf : byChar, byCodeUnit, byDchar, byWchar, invalidUTFstrings; + import std.utf : byChar, byWchar, byDchar, byCodeUnit, invalidUTFstrings; assert(chop("hello world".byChar).array == "hello worl"); assert(chop("hello world\n"w.byWchar).array == "hello world"w); @@ -3719,7 +3719,7 @@ if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) && static if (C.sizeof == 1) { - import std.utf : byChar, byDchar; + import std.utf : byDchar, byChar; return leftJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) @@ -3862,7 +3862,7 @@ if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && static if (C.sizeof == 1) { - import std.utf : byChar, byDchar; + import std.utf : byDchar, byChar; return rightJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) @@ -4090,7 +4090,7 @@ if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && static if (C.sizeof == 1) { - import std.utf : byChar, byDchar; + import std.utf : byDchar, byChar; return centerJustifier(r.byDchar, width, fillChar).byChar; } else static if (C.sizeof == 2) @@ -4240,7 +4240,7 @@ auto detabber(Range)(Range r, size_t tabSize = 8) if (isForwardRange!Range && isSomeChar!(ElementEncodingType!Range) && !isConvertibleToString!Range) { - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; import std.utf : codeUnitLimit, decodeFront; assert(tabSize > 0); @@ -4471,7 +4471,7 @@ if (!(isForwardRange!Range && isSomeChar!(ElementEncodingType!Range)) && auto entabber(Range)(Range r, size_t tabSize = 8) if (isForwardRange!Range && !isConvertibleToString!Range) { - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; import std.utf : codeUnitLimit, decodeFront; assert(tabSize > 0); @@ -6513,7 +6513,7 @@ if ((isInputRange!Range && isSomeChar!(Unqual!(ElementEncodingType!Range)) || else { // decoding not needed for wchars and dchars - import std.uni : lineSep, nelSep, paraSep; + import std.uni : lineSep, paraSep, nelSep; size_t column; @@ -6545,7 +6545,7 @@ if ((isInputRange!Range && isSomeChar!(Unqual!(ElementEncodingType!Range)) || /// @safe pure unittest { - import std.utf : byChar, byDchar, byWchar; + import std.utf : byChar, byWchar, byDchar; assert(column("1234 ") == 5); assert(column("1234 "w) == 5); diff --git a/std/uni.d b/std/uni.d index 93931d6504e..d71e482063b 100644 --- a/std/uni.d +++ b/std/uni.d @@ -875,7 +875,7 @@ size_t replicateBits(size_t times, size_t bits)(size_t val) @safe pure nothrow @ @safe pure nothrow @nogc unittest // for replicate { - import std.algorithm.iteration : map, sum; + import std.algorithm.iteration : sum, map; import std.range : iota; size_t m = 0b111; size_t m2 = 0b01; @@ -3401,7 +3401,7 @@ private: import std.algorithm.comparison : equal; import std.algorithm.mutation : copy; import std.conv : text; - import std.range : chain, iota; + import std.range : iota, chain; import std.range.primitives : isBidirectionalRange, isOutputRange; void funcRef(T)(ref T u24) { @@ -5762,7 +5762,7 @@ template idxTypes(Key, size_t fullBits, Prefix...) if (is(Char1 : dchar) && is(Char2 : dchar)) { import std.algorithm.comparison : cmp; - import std.algorithm.iteration : filter, map; + import std.algorithm.iteration : map, filter; import std.ascii : toLower; static bool pred(dchar c) {return !c.isWhite && c != '-' && c != '_';} return cmp( @@ -6542,8 +6542,8 @@ if (isInputRange!Range && is(Unqual!(ElementType!Range) == dchar)) @safe unittest { import std.algorithm.comparison : equal; - import std.range : drop, take; import std.range.primitives : walkLength; + import std.range : take, drop; auto text = "noe\u0308l"; // noël using e + combining diaeresis assert(text.walkLength == 5); // 5 code points @@ -7492,7 +7492,7 @@ enum { public dchar compose(dchar first, dchar second) pure nothrow @safe { import std.algorithm.iteration : map; - import std.internal.unicode_comp : composeCntShift, composeIdxMask, compositionTable; + import std.internal.unicode_comp : compositionTable, composeCntShift, composeIdxMask; import std.range : assumeSorted; immutable packed = compositionJumpTrie[first]; if (packed == ushort.max) @@ -7539,7 +7539,7 @@ public dchar compose(dchar first, dchar second) pure nothrow @safe public Grapheme decompose(UnicodeDecomposition decompType=Canonical)(dchar ch) @safe { import std.algorithm.searching : until; - import std.internal.unicode_decomp : decompCanonTable, decompCompatTable; + import std.internal.unicode_decomp : decompCompatTable, decompCanonTable; static if (decompType == Canonical) { alias table = decompCanonTable; @@ -8115,7 +8115,7 @@ public bool isWhite(dchar c) @safe pure nothrow @nogc bool isLower(dchar c) { - import std.ascii : isASCII, isLower; + import std.ascii : isLower, isASCII; if (isASCII(c)) return isLower(c); return lowerCaseTrie[c]; @@ -8148,7 +8148,7 @@ bool isLower(dchar c) @safe pure nothrow @nogc bool isUpper(dchar c) { - import std.ascii : isASCII, isUpper; + import std.ascii : isUpper, isASCII; if (isASCII(c)) return isUpper(c); return upperCaseTrie[c]; @@ -8744,7 +8744,7 @@ private size_t encodeTo(scope dchar[] buf, size_t idx, dchar c) @trusted pure no private void toCaseInPlace(alias indexFn, uint maxIdx, alias tableFn, C)(ref C[] s) @trusted pure if (is(C == char) || is(C == wchar) || is(C == dchar)) { - import std.utf : codeLength, decode; + import std.utf : decode, codeLength; size_t curIdx = 0; size_t destIdx = 0; alias slowToCase = toCaseInPlaceAlloc!(indexFn, maxIdx, tableFn); @@ -8812,7 +8812,7 @@ private template toCaseLength(alias indexFn, uint maxIdx, alias tableFn) { size_t toCaseLength(C)(in C[] str) { - import std.utf : codeLength, decode; + import std.utf : decode, codeLength; size_t codeLen = 0; size_t lastNonTrivial = 0; size_t curIdx = 0; diff --git a/std/utf.d b/std/utf.d index f98e8182e13..339243cfcef 100644 --- a/std/utf.d +++ b/std/utf.d @@ -75,7 +75,7 @@ debug (utf) import core.stdc.stdio : printf; +/ class UTFException : Exception { - import core.internal.string : UnsignedStringBuf, unsignedToTempString; + import core.internal.string : unsignedToTempString, UnsignedStringBuf; uint[4] sequence; size_t len; diff --git a/std/uuid.d b/std/uuid.d index d4147c56f6a..a2db742c4bb 100644 --- a/std/uuid.d +++ b/std/uuid.d @@ -333,7 +333,7 @@ public struct UUID */ this(T)(in T[] uuid) if (isSomeChar!(Unqual!T)) { - import std.conv : parse, to; + import std.conv : to, parse; if (uuid.length < 36) { throw new UUIDParsingException(to!string(uuid), 0, @@ -1233,7 +1233,7 @@ if (isInputRange!RNG && isIntegral!(ElementType!RNG)) /// @safe unittest { - import std.random : unpredictableSeed, Xorshift192; + import std.random : Xorshift192, unpredictableSeed; //simple call auto uuid = randomUUID(); @@ -1253,13 +1253,13 @@ if (isInputRange!RNG && isIntegral!(ElementType!RNG)) */ @safe unittest { - import std.random : Mt19937, rndGen; + import std.random : rndGen, Mt19937; static assert(is(typeof(rndGen) == Mt19937)); } @safe unittest { - import std.random : unpredictableSeed, Xorshift192; + import std.random : Xorshift192, unpredictableSeed; //simple call auto uuid = randomUUID(); diff --git a/std/variant.d b/std/variant.d index c94b4ff211a..8ca53732568 100644 --- a/std/variant.d +++ b/std/variant.d @@ -796,7 +796,7 @@ public: @property T coerce(T)() { - import std.conv : text, to; + import std.conv : to, text; static if (isNumeric!T || isBoolean!T) { if (convertsTo!real) @@ -2690,7 +2690,7 @@ if (isAlgebraic!VariantType && Handler.length > 0) @system unittest { - import std.exception : assertNotThrown, assertThrown; + import std.exception : assertThrown, assertNotThrown; // Make sure Variant can handle types with opDispatch but no length field. struct SWithNoLength { diff --git a/std/windows/registry.d b/std/windows/registry.d index dc68e013bb8..0b5e3d2d1c3 100644 --- a/std/windows/registry.d +++ b/std/windows/registry.d @@ -45,7 +45,7 @@ import std.exception; import std.internal.cstring; private import std.internal.windows.advapi32; import std.system : Endian, endian; -import std.utf : toUTF16, toUTF8; +import std.utf : toUTF8, toUTF16; import std.windows.syserror; //debug = winreg; @@ -82,7 +82,7 @@ class Win32Exception : WindowsException @property int error() { return super.code; } } -version(unittest) import std.string : endsWith, startsWith; +version(unittest) import std.string : startsWith, endsWith; @safe unittest { diff --git a/std/windows/syserror.d b/std/windows/syserror.d index ff844dc41df..863e0c1700c 100644 --- a/std/windows/syserror.d +++ b/std/windows/syserror.d @@ -180,7 +180,7 @@ T wenforce(T)(T condition, const(char)[] name, const(wchar)* namez, string file version(Windows) @system unittest { - import std.algorithm.searching : endsWith, startsWith; + import std.algorithm.searching : startsWith, endsWith; import std.exception; import std.string; diff --git a/std/zip.d b/std/zip.d index 39dd57a8b07..47a3aa27a78 100644 --- a/std/zip.d +++ b/std/zip.d @@ -97,7 +97,7 @@ enum CompressionMethod : ushort */ final class ArchiveMember { - import std.conv : octal, to; + import std.conv : to, octal; import std.datetime : DosFileTime, SysTime, SysTimeToDosFileTime; /** @@ -853,7 +853,7 @@ debug(print) // Test if packing and unpacking produces the original data import std.conv, std.stdio; - import std.random : MinstdRand0, uniform; + import std.random : uniform, MinstdRand0; MinstdRand0 gen; const uint itemCount = 20, minSize = 10, maxSize = 500; foreach (variant; 0 .. 2)