Skip to content

Commit

Permalink
Standardize whitespace after imports
Browse files Browse the repository at this point in the history
Unified with:

sed -E "s/import\s*([^ ]+)\s*:\s*(.*(,|;))/import \1 : \2/" -i **/*.d
  • Loading branch information
wilzbach committed May 29, 2016
1 parent ff854b7 commit 2dfbc51
Show file tree
Hide file tree
Showing 47 changed files with 274 additions and 274 deletions.
8 changes: 4 additions & 4 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -2949,7 +2949,7 @@ unittest
@safe unittest //12569
{
import std.algorithm.comparison : max, min;
import std.typecons: tuple;
import std.typecons : tuple;
dchar c = 'a';
reduce!(min, max)(tuple(c, c), "hello"); // OK
static assert(!is(typeof(reduce!(min, max)(tuple(c), "hello"))));
Expand Down Expand Up @@ -3029,7 +3029,7 @@ template fold(fun...) if (fun.length >= 1)
}
else
{
import std.typecons: tuple;
import std.typecons : tuple;
return reduce!fun(tuple(seed), r);
}
}
Expand All @@ -3046,8 +3046,8 @@ template fold(fun...) 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.typecons: tuple;
import std.algorithm.comparison : min, max;
import std.typecons : tuple;

// Compute minimum and maximum at the same time
assert(arr.fold!(min, max) == tuple(1, 5));
Expand Down
14 changes: 7 additions & 7 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ See_Also:
size_t bringToFront(Range1, Range2)(Range1 front, Range2 back)
if (isInputRange!Range1 && isForwardRange!Range2)
{
import std.range: take, Take;
import std.array: sameHead;
import std.range : take, Take;
import std.array : sameHead;
enum bool sameHeadExists = is(typeof(front.sameHead(back)));
size_t result;
for (bool semidone; !front.empty && !back.empty; )
Expand Down Expand Up @@ -758,7 +758,7 @@ void initializeAll(Range)(Range range)
///
unittest
{
import core.stdc.stdlib: malloc, free;
import core.stdc.stdlib : malloc, free;

struct S
{
Expand Down Expand Up @@ -2416,15 +2416,15 @@ void swapAt(R)(auto ref R r, size_t i1, size_t i2)
///
pure @safe nothrow unittest
{
import std.algorithm.comparison: equal;
import std.algorithm.comparison : equal;
auto a = [1, 2, 3];
a.swapAt(1, 2);
assert(a.equal([1, 3, 2]));
}

pure @safe nothrow unittest
{
import std.algorithm.comparison: equal;
import std.algorithm.comparison : equal;
auto a = [4, 5, 6];
a.swapAt(1, 1);
assert(a.equal([4, 5, 6]));
Expand All @@ -2433,8 +2433,8 @@ pure @safe nothrow unittest
pure @safe nothrow unittest
{
// test non random access ranges
import std.algorithm.comparison: equal;
import std.array: array;
import std.algorithm.comparison : equal;
import std.array : array;

char[] b = ['a', 'b', 'c'];
b.swapAt(1, 2);
Expand Down
8 changes: 4 additions & 4 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -3127,7 +3127,7 @@ auto minElement(alias map = "a", Range, RangeElementType = ElementType!Range)
///
@safe pure unittest
{
import std.range: enumerate;
import std.range : enumerate;

assert([2, 1, 4, 3].minElement == 1);

Expand All @@ -3144,7 +3144,7 @@ auto minElement(alias map = "a", Range, RangeElementType = ElementType!Range)

@safe pure unittest
{
import std.range: enumerate, iota;
import std.range : enumerate, iota;
// supports mapping
assert([3, 4, 5, 1, 2].enumerate.minElement!"a.value" == tuple(3, 1));
assert([5, 2, 4].enumerate.minElement!"a.value" == tuple(1, 2));
Expand Down Expand Up @@ -3217,7 +3217,7 @@ auto maxElement(alias map = "a", Range, RangeElementType = ElementType!Range)
///
@safe pure unittest
{
import std.range: enumerate;
import std.range : enumerate;
assert([2, 1, 4, 3].maxElement == 4);

// allows to get the index of an element too
Expand All @@ -3233,7 +3233,7 @@ auto maxElement(alias map = "a", Range, RangeElementType = ElementType!Range)

@safe pure unittest
{
import std.range: enumerate, iota;
import std.range : enumerate, iota;

// supports mapping
assert([3, 4, 5, 1, 2].enumerate.maxElement!"a.value" == tuple(2, 5));
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/setops.d
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ auto cartesianProduct(R1, R2)(R1 range1, R2 range2)
// Issue 13091
pure nothrow @safe @nogc unittest
{
import std.algorithm: cartesianProduct;
import std.algorithm : cartesianProduct;
int[1] a = [1];
foreach (t; cartesianProduct(a[], a[])) {}
}
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ template multiSort(less...) //if (less.length > 1)
if (validPredicates!(ElementType!Range, less))
{
import std.range : assumeSorted;
import std.meta: AliasSeq;
import std.meta : AliasSeq;
static if (is(typeof(less[$ - 1]) == SwapStrategy))
{
enum ss = less[$ - 1];
Expand Down
2 changes: 1 addition & 1 deletion std/bigint.d
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ unittest

unittest
{
import std.math:abs;
import std.math : abs;
auto r = abs(BigInt(-1000)); // 6486
assert(r == 1000);

Expand Down
8 changes: 4 additions & 4 deletions std/bitmanip.d
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ struct BitArray
private:

import std.format : FormatSpec;
import core.bitop: bts, btr, bsf, bt;
import core.bitop : bts, btr, bsf, bt;

size_t _len;
size_t* _ptr;
Expand Down Expand Up @@ -2182,13 +2182,13 @@ private ushort swapEndianImpl(ushort val) @safe pure nothrow @nogc

private uint swapEndianImpl(uint val) @trusted pure nothrow @nogc
{
import core.bitop: bswap;
import core.bitop : bswap;
return bswap(val);
}

private ulong swapEndianImpl(ulong val) @trusted pure nothrow @nogc
{
import core.bitop: bswap;
import core.bitop : bswap;
immutable ulong res = bswap(cast(uint)val);
return res << 32 | bswap(cast(uint)(val >> 32));
}
Expand Down Expand Up @@ -3977,7 +3977,7 @@ unittest
unittest
{
import std.algorithm : equal;
import std.range: iota;
import std.range : iota;

import std.meta;
foreach (T; AliasSeq!(byte, ubyte, short, ushort, int, uint, long, ulong))
Expand Down
2 changes: 1 addition & 1 deletion std/c/stdlib.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ deprecated("Import core.stdc.stdlib or core.sys.posix.stdlib instead")
module std.c.stdlib;

public import core.stdc.stdlib;
version(Posix) public import core.sys.posix.stdlib: setenv, unsetenv;
version(Posix) public import core.sys.posix.stdlib : setenv, unsetenv;
4 changes: 2 additions & 2 deletions std/complex.d
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ struct Complex(T) if (isFloatingPoint!T)
ref Complex opOpAssign(string op, C)(C z)
if (op == "^^" && is(C R == Complex!R))
{
import std.math: exp, log, cos, 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);
Expand Down Expand Up @@ -388,7 +388,7 @@ struct Complex(T) if (isFloatingPoint!T)
ref Complex opOpAssign(string op, R)(R r)
if (op == "^^" && isFloatingPoint!R)
{
import std.math: cos, sin;
import std.math : cos, sin;
immutable ab = abs(this)^^r;
immutable ar = arg(this)*r;
re = ab*cos(ar);
Expand Down
8 changes: 4 additions & 4 deletions std/container/dlist.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module std.container.dlist;
///
unittest
{
import std.container: DList;
import std.algorithm: equal;
import std.container : DList;
import std.algorithm : equal;

auto s = DList!int(1, 2, 3);
assert(equal(s[], [1, 2, 3]));
Expand All @@ -37,8 +37,8 @@ unittest
assert(equal(s[], [4, 5, 2, 6, 7]));

// If you want to apply range operations, simply slice it.
import std.algorithm: countUntil;
import std.range: popFrontN, popBackN, walkLength;
import std.algorithm : countUntil;
import std.range : popFrontN, popBackN, walkLength;

auto sl = DList!int([1, 2, 3, 4, 5]);
assert(countUntil(sl[], 2) == 1);
Expand Down
8 changes: 4 additions & 4 deletions std/container/rbtree.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module std.container.rbtree;
unittest
{
import std.container.rbtree;
import std.algorithm: equal;
import std.algorithm : equal;

auto rbt = redBlackTree(3, 1, 4, 2, 5);
assert(rbt.front == 1);
Expand All @@ -41,7 +41,7 @@ unittest
assert(rbt.upperBound(3).equal([4, 5]));

// A Red Black tree with the highest element at front:
import std.range: iota;
import std.range : iota;
auto maxTree = redBlackTree!"a > b"(iota(5));
assert(equal(maxTree[], [4, 3, 2, 1, 0]));

Expand Down Expand Up @@ -1853,8 +1853,8 @@ auto redBlackTree(alias less, bool allowDuplicates, E)(E[] elems...)
}


import std.range.primitives: isInputRange, isSomeString, ElementType;
import std.traits: isArray;
import std.range.primitives : isInputRange, isSomeString, ElementType;
import std.traits : isArray;

/++ Ditto +/
auto redBlackTree(Stuff)(Stuff range)
Expand Down
10 changes: 5 additions & 5 deletions std/container/slist.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module std.container.slist;
///
unittest
{
import std.container: SList;
import std.algorithm: equal;
import std.container : SList;
import std.algorithm : equal;

auto s = SList!int(1, 2, 3);
assert(equal(s[], [1, 2, 3]));
Expand All @@ -33,8 +33,8 @@ unittest
assert(equal(s[], [5, 6, 2, 3]));

// If you want to apply range operations, simply slice it.
import std.algorithm: countUntil;
import std.range: popFrontN, walkLength;
import std.algorithm : countUntil;
import std.range : popFrontN, walkLength;

auto sl = SList!int(1, 2, 3, 4, 5);
assert(countUntil(sl[], 2) == 1);
Expand Down Expand Up @@ -727,7 +727,7 @@ unittest
unittest
{
static import std.algorithm;
import std.range: take;
import std.range : take;

// insertAfter documentation example
auto sl = SList!string(["a", "b", "d"]);
Expand Down
2 changes: 1 addition & 1 deletion std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -4888,7 +4888,7 @@ unittest //@@@9559@@@
{
import std.algorithm : map;
import std.typecons : Nullable;
import std.array: array;
import std.array : array;
alias I = Nullable!int;
auto ints = [0, 1, 2].map!(i => i & 1 ? I.init : I(i))();
auto asArray = array(ints);
Expand Down
4 changes: 2 additions & 2 deletions std/csv.d
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ unittest

unittest // const/immutable dchars
{
import std.algorithm: map;
import std.array: array;
import std.algorithm : map;
import std.array : array;
const(dchar)[] c = "foo,bar\n";
assert(csvReader(c).map!array.array == [["foo", "bar"]]);
immutable(dchar)[] i = "foo,bar\n";
Expand Down
2 changes: 1 addition & 1 deletion std/datetime.d
Original file line number Diff line number Diff line change
Expand Up @@ -8640,7 +8640,7 @@ public:

unittest
{
import std.format: format;
import std.format : format;

foreach (str; ["", "20100704000000", "20100704 000000", "20100704t000000",
"20100704T000000.", "20100704T000000.A", "20100704T000000.Z",
Expand Down
4 changes: 2 additions & 2 deletions std/experimental/allocator/gc_allocator.d
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct GCAllocator
if (n <= 16)
return 16;

import core.bitop: bsr;
import core.bitop : bsr;

auto largestBit = bsr(n-1) + 1;
if (largestBit <= 12) // 4096 or less
Expand Down Expand Up @@ -132,7 +132,7 @@ unittest

unittest
{
import core.memory: GC;
import core.memory : GC;

// test allocation sizes
assert(GCAllocator.instance.goodAllocSize(1) == 16);
Expand Down
8 changes: 4 additions & 4 deletions std/experimental/allocator/mallocator.d
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ version (Windows)
@nogc nothrow
private void* _aligned_malloc(size_t size, size_t alignment)
{
import std.c.stdlib: malloc;
import std.c.stdlib : malloc;
size_t offset = alignment + size_t.sizeof * 2 - 1;

// unaligned chunk
Expand All @@ -154,8 +154,8 @@ version (Windows)
@nogc nothrow
private void* _aligned_realloc(void* ptr, size_t size, size_t alignment)
{
import std.c.stdlib: free;
import std.c.string: memcpy;
import std.c.stdlib : free;
import std.c.string : memcpy;

if (!ptr) return _aligned_malloc(size, alignment);

Expand All @@ -181,7 +181,7 @@ version (Windows)
@nogc nothrow
private void _aligned_free(void *ptr)
{
import std.c.stdlib: free;
import std.c.stdlib : free;
if (!ptr) return;
AlignInfo* head = AlignInfo(ptr);
free(head.basePtr);
Expand Down
2 changes: 1 addition & 1 deletion std/experimental/allocator/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ unittest

unittest //bugzilla 15721
{
import std.experimental.allocator.mallocator: Mallocator;
import std.experimental.allocator.mallocator : Mallocator;

interface Foo {}
class Bar: Foo {}
Expand Down
2 changes: 1 addition & 1 deletion std/experimental/ndslice/internal.d
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ template SliceFromSeq(Range, Seq...)
alias SliceFromSeq = Range;
else
{
import std.experimental.ndslice.slice: Slice;
import std.experimental.ndslice.slice : Slice;
alias SliceFromSeq = SliceFromSeq!(Slice!(Seq[$ - 1], Range), Seq[0 .. $ - 1]);
}
}
Expand Down
Loading

0 comments on commit 2dfbc51

Please sign in to comment.