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
2 changes: 1 addition & 1 deletion etc/c/curl.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

module etc.c.curl;

import core.stdc.time;
import core.stdc.config;
import core.stdc.time;
import std.socket;

// linux
Expand Down
12 changes: 6 additions & 6 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ import std.functional; // : unaryFun, binaryFun;
import std.range.primitives;
import std.traits;
// FIXME
import std.typecons; // : tuple, Tuple, Flag, Yes;
import std.meta : allSatisfy;
import std.typecons; // : Flag, Tuple, tuple, Yes;

/**
Find $(D value) _among $(D values), returning the 1-based index
Expand Down Expand Up @@ -825,8 +825,8 @@ template equal(alias pred = "a == b")
///
@safe unittest
{
import std.math : approxEqual;
import std.algorithm.comparison : equal;
import std.math : approxEqual;

int[] a = [ 1, 2, 4, 3 ];
assert(!equal(a, a[1..$]));
Expand All @@ -851,8 +851,8 @@ range of range (of range...) comparisons.
+/
@safe unittest
{
import std.range : iota, chunks;
import std.algorithm.comparison : equal;
import std.range : chunks, iota;
assert(equal!(equal!equal)(
[[[0, 1], [2, 3]], [[4, 5], [6, 7]]],
iota(0, 8).chunks(2).chunks(2)
Expand All @@ -862,9 +862,9 @@ range of range (of range...) comparisons.
@safe unittest
{
import std.algorithm.iteration : map;
import std.math : approxEqual;
import std.internal.test.dummyrange : ReferenceForwardRange,
ReferenceInputRange, ReferenceInfiniteForwardRange;
import std.math : approxEqual;

// various strings
assert(equal("æøå", "æøå")); //UTF8 vs UTF8
Expand Down Expand Up @@ -925,7 +925,7 @@ range of range (of range...) comparisons.

@safe pure unittest
{
import std.utf : byChar, byWchar, byDchar;
import std.utf : byChar, byDchar, byWchar;
Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎


assert(equal("æøå".byChar, "æøå"));
assert(equal("æøå", "æøå".byChar));
Expand Down Expand Up @@ -1069,8 +1069,8 @@ private:
cols = c;
if (_matrix.length < rc)
{
import core.stdc.stdlib : realloc;
import core.exception : onOutOfMemoryError;
import core.stdc.stdlib : realloc;
const nbytes = mulu(rc, _matrix[0].sizeof, overflow);
if (overflow) assert(0);
auto m = cast(CostType *) realloc(_matrix.ptr, nbytes);
Expand Down
4 changes: 2 additions & 2 deletions std/algorithm/internal.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ version(unittest)

package string[] rndstuff(T : string)()
{
import std.random : Random, unpredictableSeed, uniform;
import std.random : Random, uniform, unpredictableSeed;

static Random rnd;
static bool first = true;
Expand All @@ -46,7 +46,7 @@ version(unittest)

package int[] rndstuff(T : int)()
{
import std.random : Random, unpredictableSeed, uniform;
import std.random : Random, uniform, unpredictableSeed;

static Random rnd;
static bool first = true;
Expand Down
32 changes: 16 additions & 16 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

import std.typecons : tuple;

// Compute minimum and maximum at the same time
Expand Down Expand Up @@ -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" ]));
Expand Down Expand Up @@ -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, ',');
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ][]));
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 8 additions & 8 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎


struct S
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The 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);
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ module std.algorithm;
public import std.algorithm.comparison;
public import std.algorithm.iteration;
public import std.algorithm.mutation;
public import std.algorithm.setops;
public import std.algorithm.searching;
public import std.algorithm.setops;
public import std.algorithm.sorting;

static import std.functional;
8 changes: 4 additions & 4 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,8 @@ if (isInputRange!R &&
@safe unittest
{
import std.algorithm.iteration : filterBidirectional;
import std.meta : AliasSeq;
import std.conv : to;
import std.meta : AliasSeq;

foreach (S; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring))
{
Expand Down Expand Up @@ -1631,8 +1631,8 @@ if (isInputRange!InputRange &&
{
import std.algorithm.comparison : equal;
import std.container : SList;
import std.range.primitives : empty;
import std.range;
import std.range.primitives : empty;

auto arr = assumeSorted!"a < b"([1, 2, 4, 4, 4, 4, 5, 6, 9]);
assert(find(arr, 4) == assumeSorted!"a < b"([4, 4, 4, 4, 5, 6, 9]));
Expand Down Expand Up @@ -1956,8 +1956,8 @@ if (isRandomAccessRange!R1 && hasLength!R1 && hasSlicing!R1 && isBidirectionalRa
// of the first element of the needle in haystack.
// When it is found O(walklength(needle)) steps are performed.
// 8829 enhancement
import std.range : SortedRange;
import std.algorithm.comparison : mismatch;
import std.range : SortedRange;
static if (is(R1 == R2)
&& is(R1 : SortedRange!TT, TT)
&& pred == "a == b")
Expand Down Expand Up @@ -2383,8 +2383,8 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles))))

@safe unittest
{
import std.algorithm.internal : rndstuff;
import std.algorithm.comparison : equal;
import std.algorithm.internal : rndstuff;
import std.meta : AliasSeq;
import std.range : retro;

Expand Down
Loading