Use return scope instead of just return

This commit is contained in:
dkorpel 2021-11-26 17:03:06 +01:00
parent 5d0cfcd13a
commit ea76f45494
6 changed files with 19 additions and 19 deletions

View file

@ -887,7 +887,7 @@ if (is(typeof(binaryFun!less(T.init, T.init))))
* Returns:
* true if node was added
*/
private bool _add(return Elem n)
private bool _add(return scope Elem n)
{
Node result;
static if (!allowDuplicates)

View file

@ -879,7 +879,7 @@ public:
}
// return x / y
static BigUint divInt(T)(scope return BigUint x, T y_) pure nothrow @safe
static BigUint divInt(T)(return scope BigUint x, T y_) pure nothrow @safe
if ( is(immutable T == immutable uint) )
{
uint y = y_;
@ -942,7 +942,7 @@ public:
}
// return x / y
static BigUint div(scope return BigUint x, scope BigUint y) pure nothrow @safe
static BigUint div(return scope BigUint x, scope BigUint y) pure nothrow @safe
{
if (y.data.length > x.data.length)
return BigUint(ZERO);
@ -954,7 +954,7 @@ public:
}
// return x % y
static BigUint mod(scope return BigUint x, scope BigUint y) pure nothrow @safe
static BigUint mod(return scope BigUint x, scope BigUint y) pure nothrow @safe
{
if (y.data.length > x.data.length) return x;
if (y.data.length == 1)
@ -1020,7 +1020,7 @@ public:
* exponentiation is used.
* Memory allocation is minimized: at most one temporary BigUint is used.
*/
static BigUint pow(scope return BigUint x, ulong y) pure nothrow @safe
static BigUint pow(return scope BigUint x, ulong y) pure nothrow @safe
{
// Deal with the degenerate cases first.
if (y == 0) return BigUint(ONE);
@ -1259,7 +1259,7 @@ public:
}
// Remove leading zeros from x, to restore the BigUint invariant
inout(BigDigit) [] removeLeadingZeros(scope return inout(BigDigit) [] x) pure nothrow @safe
inout(BigDigit) [] removeLeadingZeros(return scope inout(BigDigit) [] x) pure nothrow @safe
{
size_t k = x.length;
while (k>1 && x[k - 1]==0) --k;
@ -1916,7 +1916,7 @@ pure @safe unittest
// every 8 digits.
// buff.length must be data.length*8 if separator is zero,
// or data.length*9 if separator is non-zero. It will be completely filled.
char [] biguintToHex(scope return char [] buff, const scope BigDigit [] data, char separator=0,
char [] biguintToHex(return scope char [] buff, const scope BigDigit [] data, char separator=0,
LetterCase letterCase = LetterCase.upper) pure nothrow @safe
{
int x=0;

View file

@ -159,7 +159,7 @@ struct JSONValue
return store.str;
}
/// ditto
@property string str(return string v) pure nothrow @nogc @trusted return // TODO make @safe
@property string str(return scope string v) pure nothrow @nogc @trusted return // TODO make @safe
{
assign(v);
return v;
@ -282,7 +282,7 @@ struct JSONValue
return store.object;
}
/// ditto
@property JSONValue[string] object(return JSONValue[string] v) pure nothrow @nogc @trusted // TODO make @safe
@property JSONValue[string] object(return scope JSONValue[string] v) pure nothrow @nogc @trusted // TODO make @safe
{
assign(v);
return v;
@ -328,7 +328,7 @@ struct JSONValue
return store.array;
}
/// ditto
@property JSONValue[] array(return JSONValue[] v) pure nothrow @nogc @trusted scope // TODO make @safe
@property JSONValue[] array(return scope JSONValue[] v) pure nothrow @nogc @trusted scope // TODO make @safe
{
assign(v);
return v;
@ -635,7 +635,7 @@ struct JSONValue
* Hash syntax for json objects.
* Throws: `JSONException` if `type` is not `JSONType.object`.
*/
ref inout(JSONValue) opIndex(return string k) inout pure @safe
ref inout(JSONValue) opIndex(return scope string k) inout pure @safe
{
auto o = this.objectNoRef;
return *enforce!JSONException(k in o,

View file

@ -1893,7 +1893,7 @@ Note that only the first item of "matchAll" was ever used in practice
so we can return `const(Char)[]` instead of `const(Char)[][]` using a
zero-length string to indicate no match.
+/
const(Char)[] matchIPSuffix(Char)(return const(Char)[] s) @nogc nothrow pure @safe
const(Char)[] matchIPSuffix(Char)(return scope const(Char)[] s) @nogc nothrow pure @safe
{
size_t end = s.length;
if (end < 7) return null;

View file

@ -276,7 +276,7 @@ static:
multi-threaded programs. See e.g.
$(LINK2 https://www.gnu.org/software/libc/manual/html_node/Environment-Access.html#Environment-Access, glibc).
*/
inout(char)[] opIndexAssign(return inout char[] value, scope const(char)[] name) @trusted
inout(char)[] opIndexAssign(return scope inout char[] value, scope const(char)[] name) @trusted
{
version (Posix)
{

View file

@ -4315,12 +4315,12 @@ if (isSomeChar!C)
{
enum Empty = uint.max; // range is empty or just constructed
this(return R r)
this(return scope R r)
{
this.r = r;
}
this(return R r, uint buff)
this(return scope R r, uint buff)
{
this.r = r;
this.buff = buff;
@ -4328,7 +4328,7 @@ if (isSomeChar!C)
static if (isBidirectionalRange!R)
{
this(return R r, uint frontBuff, uint backBuff)
this(return scope R r, uint frontBuff, uint backBuff)
{
this.r = r;
this.buff = frontBuff;
@ -4436,12 +4436,12 @@ if (isSomeChar!C)
{
static struct Result
{
this(return R r)
this(return scope R r)
{
this.r = r;
}
this(return R r, ushort pos, ushort fill, C[4 / C.sizeof] buf)
this(return scope R r, ushort pos, ushort fill, C[4 / C.sizeof] buf)
{
this.r = r;
this.pos = pos;
@ -4451,7 +4451,7 @@ if (isSomeChar!C)
static if (isBidirectionalRange!R)
{
this(return R r, ushort frontPos, ushort frontFill,
this(return scope R r, ushort frontPos, ushort frontFill,
ushort backPos, ushort backFill, C[4 / C.sizeof] buf)
{
this.r = r;