mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 14:40:30 +03:00
clean scope imports
imports of `std.range, std.algorithm, std.array, std.string, std.format, std.uni` are affected.
This commit is contained in:
parent
b6698d0b0f
commit
c8d9afedea
16 changed files with 67 additions and 64 deletions
|
@ -409,7 +409,7 @@ private T* addressOf(T)(ref T val) { return &val; }
|
||||||
private template algoFormat()
|
private template algoFormat()
|
||||||
{
|
{
|
||||||
import std.format : format;
|
import std.format : format;
|
||||||
alias algoFormat = std.string.format;
|
alias algoFormat = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3119,7 +3119,7 @@ if (is(typeof(ElementType!Range.init == Separator.init))
|
||||||
@safe unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
import std.internal.test.dummyrange;
|
import std.internal.test.dummyrange;
|
||||||
import std.range;
|
import std.algorithm;
|
||||||
|
|
||||||
debug(std_algorithm) scope(success)
|
debug(std_algorithm) scope(success)
|
||||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||||
|
@ -3181,6 +3181,7 @@ if (is(typeof(ElementType!Range.init == Separator.init))
|
||||||
}
|
}
|
||||||
@safe unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
|
import std.algorithm;
|
||||||
import std.range;
|
import std.range;
|
||||||
auto L = retro(iota(1L, 10L));
|
auto L = retro(iota(1L, 10L));
|
||||||
auto s = splitter(L, 5L);
|
auto s = splitter(L, 5L);
|
||||||
|
@ -3658,14 +3659,14 @@ if (isSomeChar!C)
|
||||||
{
|
{
|
||||||
import std.uni : isWhite;
|
import std.uni : isWhite;
|
||||||
|
|
||||||
auto r = find!(std.uni.isWhite)(_s);
|
auto r = find!(isWhite)(_s);
|
||||||
_frontLength = _s.length - r.length;
|
_frontLength = _s.length - r.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
this(C[] s) pure @safe
|
this(C[] s) pure @safe
|
||||||
{
|
{
|
||||||
import std.string;
|
import std.string : strip;
|
||||||
_s = s.strip();
|
_s = s.strip();
|
||||||
getFirst();
|
getFirst();
|
||||||
}
|
}
|
||||||
|
@ -3731,7 +3732,7 @@ if (isSomeChar!C)
|
||||||
lines[1] = "line \ttwo".dup;
|
lines[1] = "line \ttwo".dup;
|
||||||
lines[2] = "yah last line\ryah".dup;
|
lines[2] = "yah last line\ryah".dup;
|
||||||
foreach (line; lines) {
|
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
|
if (word in dictionary) continue; // Nothing to do
|
||||||
auto newID = dictionary.length;
|
auto newID = dictionary.length;
|
||||||
dictionary[to!string(word)] = cast(uint)newID;
|
dictionary[to!string(word)] = cast(uint)newID;
|
||||||
|
@ -3748,7 +3749,7 @@ if (isSomeChar!C)
|
||||||
@safe unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
import std.conv : text;
|
import std.conv : text;
|
||||||
import std.string : split;
|
import std.array : split;
|
||||||
|
|
||||||
// Check consistency:
|
// Check consistency:
|
||||||
// All flavors of split should produce the same results
|
// All flavors of split should produce the same results
|
||||||
|
@ -5624,7 +5625,7 @@ if (Ranges.length > 1 && is(typeof(startsWith!pred(haystack, needles))))
|
||||||
|
|
||||||
@safe unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
import std.string : toUpper;
|
import std.uni : toUpper;
|
||||||
|
|
||||||
debug(std_algorithm) scope(success)
|
debug(std_algorithm) scope(success)
|
||||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||||
|
@ -10383,7 +10384,7 @@ unittest
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.random : Random, unpredictableSeed, uniform;
|
import std.random : Random, unpredictableSeed, uniform;
|
||||||
import std.string : toUpper;
|
import std.uni : toUpper;
|
||||||
|
|
||||||
debug(std_algorithm) scope(success)
|
debug(std_algorithm) scope(success)
|
||||||
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ if (isSomeString!S)
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
import std.string;
|
import std.format;
|
||||||
import std.typecons;
|
import std.typecons;
|
||||||
|
|
||||||
static auto makeEntry(S)(string l, string[] r)
|
static auto makeEntry(S)(string l, string[] r)
|
||||||
|
@ -2702,7 +2702,7 @@ unittest{
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
auto app = appender!(int[])();
|
auto app = appender!(int[])();
|
||||||
app.put(1);
|
app.put(1);
|
||||||
app.put(2);
|
app.put(2);
|
||||||
|
|
|
@ -1570,7 +1570,7 @@ public:
|
||||||
///
|
///
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
debug(bitarray) printf("BitArray.toString unittest\n");
|
debug(bitarray) printf("BitArray.toString unittest\n");
|
||||||
BitArray b;
|
BitArray b;
|
||||||
|
@ -1680,7 +1680,7 @@ public:
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
BitArray b;
|
BitArray b;
|
||||||
|
|
||||||
|
@ -3424,7 +3424,7 @@ unittest
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.array;
|
import std.array;
|
||||||
import std.typetuple;
|
import std.typetuple;
|
||||||
foreach(endianness; TypeTuple!(Endian.bigEndian, Endian.littleEndian))
|
foreach(endianness; TypeTuple!(Endian.bigEndian, Endian.littleEndian))
|
||||||
|
|
|
@ -141,7 +141,7 @@ struct Complex(T) if (isFloatingPoint!T)
|
||||||
// Formatting with std.string.format specs: the precision and width
|
// Formatting with std.string.format specs: the precision and width
|
||||||
// specifiers apply to both the real and imaginary parts of the
|
// specifiers apply to both the real and imaginary parts of the
|
||||||
// complex number.
|
// complex number.
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
assert(format("%.2f", c) == "1.20+3.40i");
|
assert(format("%.2f", c) == "1.20+3.40i");
|
||||||
assert(format("%4.1f", c) == " 1.2+ 3.4i");
|
assert(format("%4.1f", c) == " 1.2+ 3.4i");
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ unittest
|
||||||
// Issue 10881: support %f formatting of complex numbers
|
// Issue 10881: support %f formatting of complex numbers
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
auto x = complex(1.2, 3.4);
|
auto x = complex(1.2, 3.4);
|
||||||
assert(format("%.2f", x) == "1.20+3.40i");
|
assert(format("%.2f", x) == "1.20+3.40i");
|
||||||
|
|
|
@ -1209,7 +1209,7 @@ public:
|
||||||
void popFront()
|
void popFront()
|
||||||
{
|
{
|
||||||
static if (ErrorLevel == Malformed.throwException)
|
static if (ErrorLevel == Malformed.throwException)
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
// Skip last of record when header is depleted.
|
// Skip last of record when header is depleted.
|
||||||
if (_popCount.ptr && _popCount.empty)
|
if (_popCount.ptr && _popCount.empty)
|
||||||
while(!recordEnd())
|
while(!recordEnd())
|
||||||
|
|
|
@ -496,7 +496,7 @@ private:
|
||||||
+/
|
+/
|
||||||
struct SysTime
|
struct SysTime
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.typecons : Rebindable;
|
import std.typecons : Rebindable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -8835,7 +8835,7 @@ private:
|
||||||
+/
|
+/
|
||||||
struct Date
|
struct Date
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -13079,7 +13079,7 @@ private:
|
||||||
+/
|
+/
|
||||||
struct TimeOfDay
|
struct TimeOfDay
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -14294,7 +14294,7 @@ private:
|
||||||
+/
|
+/
|
||||||
struct DateTime
|
struct DateTime
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -17298,7 +17298,7 @@ private:
|
||||||
+/
|
+/
|
||||||
struct Interval(TP)
|
struct Interval(TP)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -20198,7 +20198,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
struct PosInfInterval(TP)
|
struct PosInfInterval(TP)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -22385,7 +22385,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
struct NegInfInterval(TP)
|
struct NegInfInterval(TP)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -25087,7 +25087,7 @@ unittest
|
||||||
struct IntervalRange(TP, Direction dir)
|
struct IntervalRange(TP, Direction dir)
|
||||||
if(isTimePoint!TP && dir != Direction.both)
|
if(isTimePoint!TP && dir != Direction.both)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -25585,7 +25585,7 @@ unittest
|
||||||
struct PosInfIntervalRange(TP)
|
struct PosInfIntervalRange(TP)
|
||||||
if(isTimePoint!TP)
|
if(isTimePoint!TP)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -25873,7 +25873,7 @@ unittest
|
||||||
struct NegInfIntervalRange(TP)
|
struct NegInfIntervalRange(TP)
|
||||||
if(isTimePoint!TP)
|
if(isTimePoint!TP)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -26136,7 +26136,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
abstract class TimeZone
|
abstract class TimeZone
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/++
|
/++
|
||||||
|
@ -26277,7 +26277,7 @@ auto tz = TimeZone.getTimeZone("America/Los_Angeles");
|
||||||
return PosixTimeZone.getTimeZone(name);
|
return PosixTimeZone.getTimeZone(name);
|
||||||
else version(Windows)
|
else version(Windows)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
if(auto windowsTZName = tzDatabaseNameToWindowsTZName(name))
|
if(auto windowsTZName = tzDatabaseNameToWindowsTZName(name))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -27258,7 +27258,7 @@ private:
|
||||||
+/
|
+/
|
||||||
final class UTC : TimeZone
|
final class UTC : TimeZone
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -27392,7 +27392,7 @@ private:
|
||||||
+/
|
+/
|
||||||
final class SimpleTimeZone : TimeZone
|
final class SimpleTimeZone : TimeZone
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -28718,7 +28718,7 @@ else version(Windows)
|
||||||
{
|
{
|
||||||
final class WindowsTimeZone : TimeZone
|
final class WindowsTimeZone : TimeZone
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
import std.algorithm : sort;
|
import std.algorithm : sort;
|
||||||
import std.array : appender;
|
import std.array : appender;
|
||||||
|
@ -29547,7 +29547,7 @@ string tzDatabaseNameToWindowsTZName(string tzName) @safe pure nothrow @nogc
|
||||||
|
|
||||||
version(Windows) unittest
|
version(Windows) unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
foreach(tzName; TimeZone.getInstalledTZNames())
|
foreach(tzName; TimeZone.getInstalledTZNames())
|
||||||
assert(tzDatabaseNameToWindowsTZName(tzName) !is null, format("TZName which failed: %s", tzName));
|
assert(tzDatabaseNameToWindowsTZName(tzName) !is null, format("TZName which failed: %s", tzName));
|
||||||
}
|
}
|
||||||
|
@ -29692,7 +29692,7 @@ string windowsTZNameToTZDatabaseName(string tzName) @safe pure nothrow @nogc
|
||||||
|
|
||||||
version(Windows) unittest
|
version(Windows) unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
foreach(tzName; WindowsTimeZone.getInstalledTZNames())
|
foreach(tzName; WindowsTimeZone.getInstalledTZNames())
|
||||||
assert(windowsTZNameToTZDatabaseName(tzName) !is null, format("TZName which failed: %s", tzName));
|
assert(windowsTZNameToTZDatabaseName(tzName) !is null, format("TZName which failed: %s", tzName));
|
||||||
}
|
}
|
||||||
|
@ -30205,7 +30205,7 @@ static bool yearIsLeapYear(int year) @safe pure nothrow
|
||||||
|
|
||||||
unittest
|
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,
|
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])
|
2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011])
|
||||||
{
|
{
|
||||||
|
@ -31471,7 +31471,7 @@ bool validTimeUnits(string[] units...) @safe pure nothrow
|
||||||
+/
|
+/
|
||||||
int cmpTimeUnits(string lhs, string rhs) @safe pure
|
int cmpTimeUnits(string lhs, string rhs) @safe pure
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.algorithm : countUntil;
|
import std.algorithm : countUntil;
|
||||||
|
|
||||||
auto tstrings = timeStrings;
|
auto tstrings = timeStrings;
|
||||||
|
@ -31643,7 +31643,7 @@ void enforceValid(string units)(int value, string file = __FILE__, size_t line =
|
||||||
units == "minutes" ||
|
units == "minutes" ||
|
||||||
units == "seconds")
|
units == "seconds")
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
static if(units == "months")
|
static if(units == "months")
|
||||||
{
|
{
|
||||||
|
@ -31685,7 +31685,7 @@ void enforceValid(string units)
|
||||||
(int year, Month month, int day, string file = __FILE__, size_t line = __LINE__) @safe pure
|
(int year, Month month, int day, string file = __FILE__, size_t line = __LINE__) @safe pure
|
||||||
if(units == "days")
|
if(units == "days")
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
if(!valid!"days"(year, month, day))
|
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);
|
throw new DateTimeException(format("%s is not a valid day in %s in %s", day, month, year), file, line);
|
||||||
}
|
}
|
||||||
|
@ -32317,7 +32317,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
string monthToString(Month month) @safe pure
|
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));
|
assert(month >= Month.jan && month <= Month.dec, format("Invalid month: %s", month));
|
||||||
return _monthNames[month - Month.jan];
|
return _monthNames[month - Month.jan];
|
||||||
}
|
}
|
||||||
|
@ -32350,7 +32350,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
Month monthFromString(string monthStr) @safe pure
|
Month monthFromString(string monthStr) @safe pure
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
switch(monthStr)
|
switch(monthStr)
|
||||||
{
|
{
|
||||||
case "Jan":
|
case "Jan":
|
||||||
|
@ -32456,7 +32456,7 @@ unittest
|
||||||
+/
|
+/
|
||||||
static string fracSecsToISOString(int hnsecs) @safe pure nothrow
|
static string fracSecsToISOString(int hnsecs) @safe pure nothrow
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
assert(hnsecs >= 0);
|
assert(hnsecs >= 0);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -1301,7 +1301,7 @@ struct EmailStatus
|
||||||
/// Returns a textual representation of the email status
|
/// Returns a textual representation of the email status
|
||||||
string toString ()
|
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,
|
return format("EmailStatus\n{\n\tvalid: %s\n\tlocalPart: %s\n\tdomainPart: %s\n\tstatusCode: %s\n}", valid,
|
||||||
localPart, domainPart, statusCode);
|
localPart, domainPart, statusCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4187,7 +4187,7 @@ unittest
|
||||||
void next(ref char[] buf)
|
void next(ref char[] buf)
|
||||||
{
|
{
|
||||||
file.readln(buf);
|
file.readln(buf);
|
||||||
import std.string;
|
import std.string : chomp;
|
||||||
buf = chomp(buf);
|
buf = chomp(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2895,12 +2895,14 @@ string expandTilde(string inputPath)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
import std.string : indexOf;
|
||||||
|
|
||||||
assert(path.length > 2 || (path.length == 2 && !isDirSeparator(path[1])));
|
assert(path.length > 2 || (path.length == 2 && !isDirSeparator(path[1])));
|
||||||
assert(path[0] == '~');
|
assert(path[0] == '~');
|
||||||
|
|
||||||
// Extract username, searching for path separator.
|
// Extract username, searching for path separator.
|
||||||
string username;
|
string username;
|
||||||
auto last_char = std.string.indexOf(path, dirSeparator[0]);
|
auto last_char = indexOf(path, dirSeparator[0]);
|
||||||
|
|
||||||
if (last_char == -1)
|
if (last_char == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -646,14 +646,14 @@ unittest
|
||||||
{
|
{
|
||||||
void test(alias matchFn)()
|
void test(alias matchFn)()
|
||||||
{
|
{
|
||||||
import std.string : toUpper;
|
import std.uni : toUpper;
|
||||||
|
|
||||||
foreach(i, v; TypeTuple!(string, wstring, dstring))
|
foreach(i, v; TypeTuple!(string, wstring, dstring))
|
||||||
{
|
{
|
||||||
auto baz(Cap)(Cap m)
|
auto baz(Cap)(Cap m)
|
||||||
if (is(Cap == Captures!(Cap.String)))
|
if (is(Cap == Captures!(Cap.String)))
|
||||||
{
|
{
|
||||||
return std.string.toUpper(m.hit);
|
return toUpper(m.hit);
|
||||||
}
|
}
|
||||||
alias String = v;
|
alias String = v;
|
||||||
assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c"))
|
assert(std.regex.replace!(matchFn)(to!String("ark rapacity"), regex(to!String("r")), to!String("c"))
|
||||||
|
|
|
@ -490,7 +490,7 @@ Throws: $(D ErrnoException) in case of error.
|
||||||
void windowsHandleOpen(HANDLE handle, in char[] stdioOpenmode)
|
void windowsHandleOpen(HANDLE handle, in char[] stdioOpenmode)
|
||||||
{
|
{
|
||||||
import std.exception : errnoEnforce;
|
import std.exception : errnoEnforce;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
// Create file descriptors from the handles
|
// Create file descriptors from the handles
|
||||||
version (DIGITAL_MARS_STDIO)
|
version (DIGITAL_MARS_STDIO)
|
||||||
|
@ -630,7 +630,7 @@ Throws: $(D ErrnoException) on error.
|
||||||
scope(exit) _p.handle = null; // nullify the handle anyway
|
scope(exit) _p.handle = null; // nullify the handle anyway
|
||||||
version (Posix)
|
version (Posix)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
if (_p.isPopened)
|
if (_p.isPopened)
|
||||||
{
|
{
|
||||||
|
|
|
@ -534,7 +534,7 @@ unittest
|
||||||
private template fqnType(T,
|
private template fqnType(T,
|
||||||
bool alreadyConst, bool alreadyImmutable, bool alreadyShared, bool alreadyInout)
|
bool alreadyConst, bool alreadyImmutable, bool alreadyShared, bool alreadyInout)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
|
|
||||||
// Convenience tags
|
// Convenience tags
|
||||||
enum {
|
enum {
|
||||||
|
@ -740,7 +740,7 @@ private template fqnType(T,
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
alias fqn = fullyQualifiedName;
|
alias fqn = fullyQualifiedName;
|
||||||
|
|
||||||
// Verify those 2 are the same for simple case
|
// Verify those 2 are the same for simple case
|
||||||
|
|
20
std/uni.d
20
std/uni.d
|
@ -2350,7 +2350,7 @@ public:
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.uni : unicode;
|
import std.uni : unicode;
|
||||||
|
|
||||||
assert(unicode.Cyrillic.to!string ==
|
assert(unicode.Cyrillic.to!string ==
|
||||||
|
@ -2369,7 +2369,7 @@ public:
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.exception : assertThrown;
|
import std.exception : assertThrown;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
assertThrown!FormatException(format("%a", unicode.ASCII));
|
assertThrown!FormatException(format("%a", unicode.ASCII));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2538,7 +2538,7 @@ public:
|
||||||
string toSourceCode(string funcName="")
|
string toSourceCode(string funcName="")
|
||||||
{
|
{
|
||||||
import std.array : array;
|
import std.array : array;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.algorithm : countUntil;
|
import std.algorithm : countUntil;
|
||||||
enum maxBinary = 3;
|
enum maxBinary = 3;
|
||||||
static string linearScope(R)(R ivals, string indent)
|
static string linearScope(R)(R ivals, string indent)
|
||||||
|
@ -4740,7 +4740,7 @@ template Utf8Matcher()
|
||||||
// from 3 primitives: tab!(size), lookup and Sizes
|
// from 3 primitives: tab!(size), lookup and Sizes
|
||||||
mixin template DefMatcher()
|
mixin template DefMatcher()
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
enum hasASCII = staticIndexOf!(1, Sizes) >= 0;
|
enum hasASCII = staticIndexOf!(1, Sizes) >= 0;
|
||||||
alias UniSizes = Erase!(1, Sizes);
|
alias UniSizes = Erase!(1, Sizes);
|
||||||
|
|
||||||
|
@ -5376,7 +5376,7 @@ package auto units(C)(C[] s)
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.exception : collectException;
|
import std.exception : collectException;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
import std.algorithm;
|
import std.algorithm;
|
||||||
auto utf16 = utfMatcher!wchar(unicode.L);
|
auto utf16 = utfMatcher!wchar(unicode.L);
|
||||||
auto utf8 = utfMatcher!char(unicode.L);
|
auto utf8 = utfMatcher!char(unicode.L);
|
||||||
|
@ -8496,7 +8496,7 @@ S toLower(S)(S s) @trusted pure
|
||||||
|
|
||||||
@trusted unittest //@@@BUG std.format is not @safe
|
@trusted unittest //@@@BUG std.format is not @safe
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
foreach(ch; 0..0x80)
|
foreach(ch; 0..0x80)
|
||||||
assert(std.ascii.toLower(ch) == toLower(ch));
|
assert(std.ascii.toLower(ch) == toLower(ch));
|
||||||
assert(toLower('Я') == 'я');
|
assert(toLower('Я') == 'я');
|
||||||
|
@ -8603,7 +8603,7 @@ dchar toUpper(dchar c)
|
||||||
|
|
||||||
@trusted unittest
|
@trusted unittest
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
foreach(ch; 0..0x80)
|
foreach(ch; 0..0x80)
|
||||||
assert(std.ascii.toUpper(ch) == toUpper(ch));
|
assert(std.ascii.toUpper(ch) == toUpper(ch));
|
||||||
assert(toUpper('я') == 'Я');
|
assert(toUpper('я') == 'Я');
|
||||||
|
@ -8671,7 +8671,7 @@ unittest
|
||||||
{
|
{
|
||||||
static void doTest(C)(const(C)[] s, const(C)[] trueUp, const(C)[] trueLow)
|
static void doTest(C)(const(C)[] s, const(C)[] trueUp, const(C)[] trueLow)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
string diff = "src: %( %x %)\nres: %( %x %)\ntru: %( %x %)";
|
string diff = "src: %( %x %)\nres: %( %x %)\ntru: %( %x %)";
|
||||||
auto low = s.toLower() , up = s.toUpper();
|
auto low = s.toLower() , up = s.toUpper();
|
||||||
auto lowInp = s.dup, upInp = s.dup;
|
auto lowInp = s.dup, upInp = s.dup;
|
||||||
|
@ -8834,7 +8834,7 @@ bool isSymbol(dchar c)
|
||||||
|
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
import std.string;
|
import std.format : format;
|
||||||
assert(isSymbol('\u0024'));
|
assert(isSymbol('\u0024'));
|
||||||
assert(isSymbol('\u002B'));
|
assert(isSymbol('\u002B'));
|
||||||
assert(isSymbol('\u005E'));
|
assert(isSymbol('\u005E'));
|
||||||
|
@ -8881,7 +8881,7 @@ bool isGraphical(dchar c)
|
||||||
unittest
|
unittest
|
||||||
{
|
{
|
||||||
auto set = unicode("Graphical");
|
auto set = unicode("Graphical");
|
||||||
import std.string;
|
import std.format : format;
|
||||||
foreach(ch; set.byCodepoint)
|
foreach(ch; set.byCodepoint)
|
||||||
assert(isGraphical(ch), format("%4x", ch));
|
assert(isGraphical(ch), format("%4x", ch));
|
||||||
foreach(ch; 0..0x4000)
|
foreach(ch; 0..0x4000)
|
||||||
|
|
|
@ -397,19 +397,19 @@ size_t uriLength(Char)(in Char[] s) if (isSomeChar!Char)
|
||||||
* https://
|
* https://
|
||||||
* www.
|
* www.
|
||||||
*/
|
*/
|
||||||
import std.string : icmp;
|
import std.uni : icmp;
|
||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (s.length <= 4)
|
if (s.length <= 4)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (s.length > 7 && std.string.icmp(s[0 .. 7], "http://") == 0) {
|
if (s.length > 7 && icmp(s[0 .. 7], "http://") == 0) {
|
||||||
i = 7;
|
i = 7;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s.length > 8 && std.string.icmp(s[0 .. 8], "https://") == 0)
|
if (s.length > 8 && icmp(s[0 .. 8], "https://") == 0)
|
||||||
i = 8;
|
i = 8;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -1565,7 +1565,7 @@ public class UUIDParsingException : Exception
|
||||||
Throwable next = null, string file = __FILE__, size_t line = __LINE__) pure @trusted
|
Throwable next = null, string file = __FILE__, size_t line = __LINE__) pure @trusted
|
||||||
{
|
{
|
||||||
import std.array : replace;
|
import std.array : replace;
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.position = pos;
|
this.position = pos;
|
||||||
this.reason = why;
|
this.reason = why;
|
||||||
|
|
|
@ -954,7 +954,7 @@ public:
|
||||||
{
|
{
|
||||||
string tryUseType(string tp)
|
string tryUseType(string tp)
|
||||||
{
|
{
|
||||||
import std.string : format;
|
import std.format : format;
|
||||||
return q{
|
return q{
|
||||||
static if (allowed!%1$s && T.allowed!%1$s)
|
static if (allowed!%1$s && T.allowed!%1$s)
|
||||||
if (convertsTo!%1$s && other.convertsTo!%1$s)
|
if (convertsTo!%1$s && other.convertsTo!%1$s)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue