Skip to content

Commit

Permalink
Merge pull request #2755 from 9il/imports
Browse files Browse the repository at this point in the history
clean scope imports
  • Loading branch information
H. S. Teoh committed Nov 21, 2014
2 parents 904fedc + c8d9afe commit daaa7c7
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 64 deletions.
17 changes: 9 additions & 8 deletions std/algorithm.d
Expand Up @@ -409,7 +409,7 @@ private T* addressOf(T)(ref T val) { return &val; }
private template algoFormat()
{
import std.format : format;
alias algoFormat = std.string.format;
alias algoFormat = format;
}

/**
Expand Down Expand Up @@ -3119,7 +3119,7 @@ if (is(typeof(ElementType!Range.init == Separator.init))
@safe unittest
{
import std.internal.test.dummyrange;
import std.range;
import std.algorithm;

debug(std_algorithm) scope(success)
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
Expand Down Expand Up @@ -3181,6 +3181,7 @@ if (is(typeof(ElementType!Range.init == Separator.init))
}
@safe unittest
{
import std.algorithm;
import std.range;
auto L = retro(iota(1L, 10L));
auto s = splitter(L, 5L);
Expand Down Expand Up @@ -3658,14 +3659,14 @@ if (isSomeChar!C)
{
import std.uni : isWhite;

auto r = find!(std.uni.isWhite)(_s);
auto r = find!(isWhite)(_s);
_frontLength = _s.length - r.length;
}

public:
this(C[] s) pure @safe
{
import std.string;
import std.string : strip;
_s = s.strip();
getFirst();
}
Expand Down Expand Up @@ -3731,7 +3732,7 @@ if (isSomeChar!C)
lines[1] = "line \ttwo".dup;
lines[2] = "yah last line\ryah".dup;
foreach (line; lines) {
foreach (word; std.array.splitter(std.string.strip(line))) {
foreach (word; splitter(strip(line))) {
if (word in dictionary) continue; // Nothing to do
auto newID = dictionary.length;
dictionary[to!string(word)] = cast(uint)newID;
Expand All @@ -3748,7 +3749,7 @@ if (isSomeChar!C)
@safe unittest
{
import std.conv : text;
import std.string : split;
import std.array : split;

// Check consistency:
// All flavors of split should produce the same results
Expand Down Expand Up @@ -5624,7 +5625,7 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles))))

@safe unittest
{
import std.string : toUpper;
import std.uni : toUpper;

debug(std_algorithm) scope(success)
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
Expand Down Expand Up @@ -10383,7 +10384,7 @@ unittest
unittest
{
import std.random : Random, unpredictableSeed, uniform;
import std.string : toUpper;
import std.uni : toUpper;

debug(std_algorithm) scope(success)
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
Expand Down
4 changes: 2 additions & 2 deletions std/array.d
Expand Up @@ -1250,7 +1250,7 @@ if (isSomeString!S)
unittest
{
import std.conv : to;
import std.string;
import std.format;
import std.typecons;

static auto makeEntry(S)(string l, string[] r)
Expand Down Expand Up @@ -2702,7 +2702,7 @@ unittest{

unittest
{
import std.string : format;
import std.format : format;
auto app = appender!(int[])();
app.put(1);
app.put(2);
Expand Down
6 changes: 3 additions & 3 deletions std/bitmanip.d
Expand Up @@ -1570,7 +1570,7 @@ public:
///
unittest
{
import std.string : format;
import std.format : format;

debug(bitarray) printf("BitArray.toString unittest\n");
BitArray b;
Expand Down Expand Up @@ -1680,7 +1680,7 @@ public:

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

BitArray b;

Expand Down Expand Up @@ -3424,7 +3424,7 @@ unittest

unittest
{
import std.string : format;
import std.format : format;
import std.array;
import std.typetuple;
foreach(endianness; TypeTuple!(Endian.bigEndian, Endian.littleEndian))
Expand Down
4 changes: 2 additions & 2 deletions std/complex.d
Expand Up @@ -141,7 +141,7 @@ struct Complex(T) if (isFloatingPoint!T)
// Formatting with std.string.format specs: the precision and width
// specifiers apply to both the real and imaginary parts of the
// complex number.
import std.string : format;
import std.format : format;
assert(format("%.2f", c) == "1.20+3.40i");
assert(format("%4.1f", c) == " 1.2+ 3.4i");
}
Expand Down Expand Up @@ -866,7 +866,7 @@ unittest
// Issue 10881: support %f formatting of complex numbers
unittest
{
import std.string : format;
import std.format : format;

auto x = complex(1.2, 3.4);
assert(format("%.2f", x) == "1.20+3.40i");
Expand Down
2 changes: 1 addition & 1 deletion std/csv.d
Expand Up @@ -1209,7 +1209,7 @@ public:
void popFront()
{
static if (ErrorLevel == Malformed.throwException)
import std.string : format;
import std.format : format;
// Skip last of record when header is depleted.
if (_popCount.ptr && _popCount.empty)
while(!recordEnd())
Expand Down
48 changes: 24 additions & 24 deletions std/datetime.d
Expand Up @@ -496,7 +496,7 @@ private:
+/
struct SysTime
{
import std.string : format;
import std.format : format;
import std.typecons : Rebindable;

public:
Expand Down Expand Up @@ -8835,7 +8835,7 @@ private:
+/
struct Date
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -13079,7 +13079,7 @@ private:
+/
struct TimeOfDay
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -14294,7 +14294,7 @@ private:
+/
struct DateTime
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -17298,7 +17298,7 @@ private:
+/
struct Interval(TP)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -20198,7 +20198,7 @@ unittest
+/
struct PosInfInterval(TP)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -22385,7 +22385,7 @@ unittest
+/
struct NegInfInterval(TP)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -25087,7 +25087,7 @@ unittest
struct IntervalRange(TP, Direction dir)
if(isTimePoint!TP && dir != Direction.both)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -25585,7 +25585,7 @@ unittest
struct PosInfIntervalRange(TP)
if(isTimePoint!TP)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -25873,7 +25873,7 @@ unittest
struct NegInfIntervalRange(TP)
if(isTimePoint!TP)
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -26136,7 +26136,7 @@ unittest
+/
abstract class TimeZone
{
import std.string : format;
import std.format : format;
public:

/++
Expand Down Expand Up @@ -26277,7 +26277,7 @@ auto tz = TimeZone.getTimeZone("America/Los_Angeles");
return PosixTimeZone.getTimeZone(name);
else version(Windows)
{
import std.string : format;
import std.format : format;
if(auto windowsTZName = tzDatabaseNameToWindowsTZName(name))
{
try
Expand Down Expand Up @@ -27258,7 +27258,7 @@ private:
+/
final class UTC : TimeZone
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -27392,7 +27392,7 @@ private:
+/
final class SimpleTimeZone : TimeZone
{
import std.string : format;
import std.format : format;

public:

Expand Down Expand Up @@ -28718,7 +28718,7 @@ else version(Windows)
{
final class WindowsTimeZone : TimeZone
{
import std.string : format;
import std.format : format;
import std.conv : to;
import std.algorithm : sort;
import std.array : appender;
Expand Down Expand Up @@ -29547,7 +29547,7 @@ string tzDatabaseNameToWindowsTZName(string tzName) @safe pure nothrow @nogc

version(Windows) unittest
{
import std.string : format;
import std.format : format;
foreach(tzName; TimeZone.getInstalledTZNames())
assert(tzDatabaseNameToWindowsTZName(tzName) !is null, format("TZName which failed: %s", tzName));
}
Expand Down Expand Up @@ -29692,7 +29692,7 @@ string windowsTZNameToTZDatabaseName(string tzName) @safe pure nothrow @nogc

version(Windows) unittest
{
import std.string : format;
import std.format : format;
foreach(tzName; WindowsTimeZone.getInstalledTZNames())
assert(windowsTZNameToTZDatabaseName(tzName) !is null, format("TZName which failed: %s", tzName));
}
Expand Down Expand Up @@ -30205,7 +30205,7 @@ static bool yearIsLeapYear(int year) @safe pure nothrow

unittest
{
import std.string : format;
import std.format : format;
foreach(year; [1, 2, 3, 5, 6, 7, 100, 200, 300, 500, 600, 700, 1998, 1999,
2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011])
{
Expand Down Expand Up @@ -31473,7 +31473,7 @@ bool validTimeUnits(string[] units...) @safe pure nothrow
+/
int cmpTimeUnits(string lhs, string rhs) @safe pure
{
import std.string : format;
import std.format : format;
import std.algorithm : countUntil;

auto tstrings = timeStrings;
Expand Down Expand Up @@ -31646,7 +31646,7 @@ void enforceValid(string units)(int value, string file = __FILE__, size_t line =
units == "minutes" ||
units == "seconds")
{
import std.string : format;
import std.format : format;

static if(units == "months")
{
Expand Down Expand Up @@ -31688,7 +31688,7 @@ void enforceValid(string units)
(int year, Month month, int day, string file = __FILE__, size_t line = __LINE__) @safe pure
if(units == "days")
{
import std.string : format;
import std.format : format;
if(!valid!"days"(year, month, day))
throw new DateTimeException(format("%s is not a valid day in %s in %s", day, month, year), file, line);
}
Expand Down Expand Up @@ -32320,7 +32320,7 @@ unittest
+/
string monthToString(Month month) @safe pure
{
import std.string : format;
import std.format : format;
assert(month >= Month.jan && month <= Month.dec, format("Invalid month: %s", month));
return _monthNames[month - Month.jan];
}
Expand Down Expand Up @@ -32353,7 +32353,7 @@ unittest
+/
Month monthFromString(string monthStr) @safe pure
{
import std.string : format;
import std.format : format;
switch(monthStr)
{
case "Jan":
Expand Down Expand Up @@ -32459,7 +32459,7 @@ unittest
+/
static string fracSecsToISOString(int hnsecs) @safe pure nothrow
{
import std.string : format;
import std.format : format;
assert(hnsecs >= 0);

try
Expand Down
2 changes: 1 addition & 1 deletion std/net/isemail.d
Expand Up @@ -1301,7 +1301,7 @@ struct EmailStatus
/// Returns a textual representation of the email status
string toString ()
{
import std.string;
import std.format : format;
return format("EmailStatus\n{\n\tvalid: %s\n\tlocalPart: %s\n\tdomainPart: %s\n\tstatusCode: %s\n}", valid,
localPart, domainPart, statusCode);
}
Expand Down
2 changes: 1 addition & 1 deletion std/parallelism.d
Expand Up @@ -4187,7 +4187,7 @@ unittest
void next(ref char[] buf)
{
file.readln(buf);
import std.string;
import std.string : chomp;
buf = chomp(buf);
}

Expand Down

0 comments on commit daaa7c7

Please sign in to comment.