@@ -70,33 +70,17 @@ string text(string separator = "", A...)(auto ref A args)
7070 }
7171 else
7272 {
73- import mir.appender: ScopedBuffer;
74- if (false )
73+ import mir.appender: scopedBuffer;
74+ auto buffer = scopedBuffer! char ;
75+ foreach (i, ref arg; args)
7576 {
76- ScopedBuffer ! char buffer;
77- foreach (i, ref arg; args)
77+ buffer.print(arg) ;
78+ static if (separator.length && i + 1 < args.length )
7879 {
79- buffer.print(arg);
80- static if (separator.length && i + 1 < args.length)
81- {
82- buffer.printStaticString! char (separator);
83- }
80+ buffer.printStaticString! char (separator);
8481 }
85- return buffer.data.idup;
8682 }
87- return () @trusted {
88- ScopedBuffer! char buffer = void ;
89- buffer.initialize;
90- foreach (i, ref arg; args)
91- {
92- buffer.print(arg);
93- static if (separator.length && i + 1 < args.length)
94- {
95- buffer.printStaticString! char (separator);
96- }
97- }
98- return buffer.data.idup;
99- } ();
83+ return buffer.data.idup;
10084 }
10185}
10286
@@ -546,8 +530,8 @@ version (mir_test) unittest
546530 yes,
547531 }
548532
549- import mir.appender: ScopedBuffer ;
550- ScopedBuffer ! char w ;
533+ import mir.appender: scopedBuffer ;
534+ auto w = scopedBuffer ! char ;
551535 w.print(Flag.yes);
552536 assert (w.data == " yes" , w.data);
553537}
@@ -573,8 +557,8 @@ ref W print(C = char, W)(scope return ref W w, bool c)
573557@safe pure nothrow @nogc
574558version (mir_test) unittest
575559{
576- import mir.appender: ScopedBuffer ;
577- ScopedBuffer ! char w ;
560+ import mir.appender: scopedBuffer ;
561+ auto w = scopedBuffer ! char ;
578562 assert (w.print(true ).data == ` true` , w.data);
579563 w.reset;
580564 assert (w.print(false ).data == ` false` , w.data);
@@ -608,8 +592,8 @@ ref W print(C = char, W, V, K)(scope return ref W w, scope const V[K] c)
608592@safe pure
609593version (mir_test) unittest
610594{
611- import mir.appender: ScopedBuffer ;
612- ScopedBuffer ! char w ;
595+ import mir.appender: scopedBuffer ;
596+ auto w = scopedBuffer ! char ;
613597 w.print([" a" : 1 , " b" : 2 ]);
614598 assert (w.data == ` ["a": 1, "b": 2]` || w.data == ` ["b": 2, "a": 1]` , w.data);
615599}
@@ -639,8 +623,8 @@ ref W print(C = char, W, T)(scope return ref W w, scope const(T)[] c)
639623@safe pure nothrow @nogc
640624version (mir_test) unittest
641625{
642- import mir.appender: ScopedBuffer ;
643- ScopedBuffer ! char w ;
626+ import mir.appender: scopedBuffer ;
627+ auto w = scopedBuffer ! char ;
644628 string [2 ] array = [" a\n a" , " b" ];
645629 assert (w.print(array[]).data == ` ["a\na", "b"]` , w.data);
646630}
@@ -691,8 +675,8 @@ ref W print(C = char, W)(scope return ref W w, char c)
691675@safe pure nothrow @nogc
692676version (mir_test) unittest
693677{
694- import mir.appender: ScopedBuffer ;
695- ScopedBuffer ! char w ;
678+ import mir.appender: scopedBuffer ;
679+ auto w = scopedBuffer ! char ;
696680 assert (w
697681 .print(' \n ' )
698682 .print(' \' ' )
@@ -902,8 +886,8 @@ version (mir_test) unittest
902886 static struct F { scope const (char )[] toString()() const return { return " f" ; } }
903887 static struct G { const (char )[] s = " g" ; alias s this ; }
904888
905- import mir.appender: ScopedBuffer ;
906- ScopedBuffer ! char w ;
889+ import mir.appender: scopedBuffer ;
890+ auto w = scopedBuffer ! char ;
907891 assert (stringBuf() << A() << S() << D() << F() << G() << getData == " asdfg" );
908892}
909893
@@ -1061,7 +1045,7 @@ ref W printZeroPad(C = char, W, I)(scope return ref W w, const I c, size_t minim
10611045version (mir_test) unittest
10621046{
10631047 import mir.appender;
1064- ScopedBuffer ! char w ;
1048+ auto w = scopedBuffer ! char ;
10651049
10661050 w.printZeroPad(- 123 , 5 );
10671051 w.put(' ' );
0 commit comments