Skip to content

Commit fee0ee1

Browse files
committed
Append nits to PR/5923
1 parent 1050089 commit fee0ee1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

std/format.d

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,12 +1746,12 @@ FormatSpec!Char singleSpec(Char)(Char[] fmt)
17461746
*
17471747
* Params:
17481748
* w = The $(REF_ALTTEXT output _range, isOutputRange, std,_range,primitives) to write to.
1749-
* obj = The value to write.
1749+
* val = The value to write.
17501750
* f = The $(REF FormatSpec, std, format) defining how to write the value.
17511751
*/
1752-
void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T obj, const ref FormatSpec!Char f)
1752+
void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T val, const ref FormatSpec!Char f)
17531753
{
1754-
formatValueImpl(w, obj, f);
1754+
formatValueImpl(w, val, f);
17551755
}
17561756

17571757
/++
@@ -1861,8 +1861,10 @@ void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T obj, const ref F
18611861
* Dynamic arrays are formatted as input ranges.
18621862
*
18631863
* Specializations:
1864-
* $(UL $(LI $(D void[]) is formatted like $(D ubyte[]).)
1865-
* $(LI Const array is converted to input range by removing its qualifier.))
1864+
* $(UL
1865+
* $(LI $(D void[]) is formatted like $(D ubyte[]).)
1866+
* $(LI Const array is converted to input range by removing its qualifier.)
1867+
* )
18661868
*/
18671869
@safe pure unittest
18681870
{
@@ -1911,8 +1913,6 @@ void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T obj, const ref F
19111913
*/
19121914
@system unittest
19131915
{
1914-
import std.format;
1915-
19161916
struct Point
19171917
{
19181918
int x, y;
@@ -1972,7 +1972,7 @@ void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T obj, const ref F
19721972
}
19731973

19741974
/// Delegates are formatted by `ReturnType delegate(Parameters) FunctionAttributes`
1975-
@safe pure unittest
1975+
@safe unittest
19761976
{
19771977
import std.conv : to;
19781978

@@ -1985,11 +1985,13 @@ void formatValue(Writer, T, Char)(auto ref Writer w, auto ref T obj, const ref F
19851985

19861986
@system int delegate(short) @nogc bar() nothrow pure
19871987
{
1988-
int* p = new int;
1988+
int* p = new int(1);
1989+
i = *p;
19891990
return &foo;
19901991
}
19911992

19921993
assert(to!string(&bar) == "int delegate(short) @nogc delegate() pure nothrow @system");
1994+
assert(() @trusted { return bar()(3); }() == 4);
19931995
}
19941996

19951997
/*
@@ -5942,7 +5944,6 @@ char[] sformat(Char, Args...)(char[] buf, in Char[] fmt, Args args)
59425944
@system unittest
59435945
{
59445946
import core.exception;
5945-
import std.format;
59465947

59475948
debug(string) trustedPrintf("std.string.sformat.unittest\n");
59485949

0 commit comments

Comments
 (0)