Skip to content

Commit

Permalink
Add more local imports
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Mar 13, 2014
1 parent 293abdd commit 6f80f6a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions std/algorithm.d
Expand Up @@ -3145,6 +3145,8 @@ if (isSomeChar!C)

void getFirst() pure @safe
{
import std.uni : isWhite;

auto r = find!(std.uni.isWhite)(_s);
_frontLength = _s.length - r.length;
}
Expand Down
10 changes: 10 additions & 0 deletions std/bitmanip.d
Expand Up @@ -1579,6 +1579,8 @@ struct BitArray
*/
@property auto bitsSet()
{
import std.algorithm : filter, map, joiner;

return iota(dim).
filter!(i => ptr[i]).
map!(i => BitsSet!size_t(ptr[i], i * bitsPerSizeT)).
Expand All @@ -1588,6 +1590,8 @@ struct BitArray
///
unittest
{
import std.algorithm : equal;

BitArray b1;
b1.init([0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]);
assert(b1.bitsSet.equal([4, 5, 6, 7, 12, 13, 14, 15]));
Expand All @@ -1602,6 +1606,8 @@ struct BitArray

unittest
{
import std.algorithm : equal;

debug(bitarray) printf("BitArray.bitsSet unittest\n");
BitArray b;
enum wordBits = size_t.sizeof * 8;
Expand Down Expand Up @@ -3635,6 +3641,8 @@ auto bitsSet(T)(T value)
///
unittest
{
import std.algorithm : equal;

assert(bitsSet(1).equal([0]));
assert(bitsSet(5).equal([0, 2]));
assert(bitsSet(-1).equal(iota(32)));
Expand All @@ -3643,6 +3651,8 @@ unittest

unittest
{
import std.algorithm : equal;

foreach (T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
{
assert(bitsSet(cast(T)0).empty);
Expand Down
4 changes: 3 additions & 1 deletion std/container.d
Expand Up @@ -2939,7 +2939,9 @@ Complexity: $(BIGOH slice.length)
/// ditto
void opSliceAssign(T value, size_t i, size_t j)
{
auto slice = _data.refCountedStore.isInitialized ? _data._payload : T[].init;
auto slice = _data.refCountedStore.isInitialized ?
_data._payload :
T[].init;
slice[i .. j] = value;
}

Expand Down
10 changes: 9 additions & 1 deletion std/stdio.d
Expand Up @@ -1716,7 +1716,7 @@ the contents may well have changed).
unittest
{
static import std.file;
import std.algorithm : take, equal;
import std.algorithm : equal;

//printf("Entering test at line %d\n", __LINE__);
scope(failure) printf("Failed test at line %d\n", __LINE__);
Expand Down Expand Up @@ -1796,6 +1796,8 @@ the contents may well have changed).

unittest
{
import std.algorithm : equal;

version(Win64)
{
/* the C function tmpfile doesn't seem to work, even when called from C */
Expand Down Expand Up @@ -2117,6 +2119,8 @@ $(D Range) that locks the file and allows fast writing to it.
}
else static if (c.sizeof == 2)
{
import std.utf : toUTF8;

if (orientation <= 0)
{
if (c <= 0x7F)
Expand All @@ -2138,6 +2142,8 @@ $(D Range) that locks the file and allows fast writing to it.
}
else // 32-bit characters
{
import std.utf : toUTF8;

if (orientation <= 0)
{
if (c <= 0x7F)
Expand Down Expand Up @@ -2223,6 +2229,8 @@ unittest

unittest
{
static import std.file;

auto deleteme = testFilename();
scope(exit) std.file.remove(deleteme);

Expand Down
2 changes: 1 addition & 1 deletion std/uni.d
Expand Up @@ -5582,7 +5582,7 @@ Range byCodePoint(Range)(Range range)
///
unittest
{
import std.string : text;
import std.conv : text;

string s = "noe\u0308l"; // noël

Expand Down

0 comments on commit 6f80f6a

Please sign in to comment.