@@ -119,20 +119,20 @@ struct Tuple(f32, &'static str);
119119#[ derive( Serialize ) ]
120120struct Struct {
121121 float : f64 ,
122- string : String ,
122+ string : & ' static str ,
123123}
124124
125125#[ derive( Serialize ) ]
126126struct NestedStruct {
127127 nested : Nested ,
128- string : String ,
128+ string : & ' static str ,
129129}
130130
131131#[ derive( Serialize ) ]
132132struct FlattenStruct {
133133 #[ serde( flatten) ]
134134 nested : Nested ,
135- string : String ,
135+ string : & ' static str ,
136136}
137137
138138#[ derive( Serialize ) ]
@@ -146,19 +146,19 @@ enum ExternallyTagged {
146146 #[ serde( rename = "$primitive=PrimitiveUnit" ) ]
147147 PrimitiveUnit ,
148148 Newtype ( bool ) ,
149- Tuple ( f64 , String ) ,
149+ Tuple ( f64 , & ' static str ) ,
150150 Struct {
151151 float : f64 ,
152- string : String ,
152+ string : & ' static str ,
153153 } ,
154154 Holder {
155155 nested : Nested ,
156- string : String ,
156+ string : & ' static str ,
157157 } ,
158158 Flatten {
159159 #[ serde( flatten) ]
160160 nested : Nested ,
161- string : String ,
161+ string : & ' static str ,
162162 } ,
163163}
164164
@@ -168,19 +168,19 @@ enum InternallyTagged {
168168 Unit ,
169169 /// Primitives (such as `bool`) are not supported by the serde in the internally tagged mode
170170 Newtype ( Nested ) ,
171- // Tuple(f64, String ),// Tuples are not supported in the internally tagged mode
171+ // Tuple(f64, &'static str ),// Tuples are not supported in the internally tagged mode
172172 Struct {
173173 float : f64 ,
174- string : String ,
174+ string : & ' static str ,
175175 } ,
176176 Holder {
177177 nested : Nested ,
178- string : String ,
178+ string : & ' static str ,
179179 } ,
180180 Flatten {
181181 #[ serde( flatten) ]
182182 nested : Nested ,
183- string : String ,
183+ string : & ' static str ,
184184 } ,
185185}
186186
@@ -189,19 +189,19 @@ enum InternallyTagged {
189189enum AdjacentlyTagged {
190190 Unit ,
191191 Newtype ( bool ) ,
192- Tuple ( f64 , String ) ,
192+ Tuple ( f64 , & ' static str ) ,
193193 Struct {
194194 float : f64 ,
195- string : String ,
195+ string : & ' static str ,
196196 } ,
197197 Holder {
198198 nested : Nested ,
199- string : String ,
199+ string : & ' static str ,
200200 } ,
201201 Flatten {
202202 #[ serde( flatten) ]
203203 nested : Nested ,
204- string : String ,
204+ string : & ' static str ,
205205 } ,
206206}
207207
@@ -210,19 +210,19 @@ enum AdjacentlyTagged {
210210enum Untagged {
211211 Unit ,
212212 Newtype ( bool ) ,
213- Tuple ( f64 , String ) ,
213+ Tuple ( f64 , & ' static str ) ,
214214 Struct {
215215 float : f64 ,
216- string : String ,
216+ string : & ' static str ,
217217 } ,
218218 Holder {
219219 nested : Nested ,
220- string : String ,
220+ string : & ' static str ,
221221 } ,
222222 Flatten {
223223 #[ serde( flatten) ]
224224 nested : Nested ,
225- string : String ,
225+ string : & ' static str ,
226226 } ,
227227}
228228
@@ -279,7 +279,7 @@ fn struct_() {
279279
280280 let node = Struct {
281281 float : 42.0 ,
282- string : "answer" . to_string ( ) ,
282+ string : "answer" ,
283283 } ;
284284 node. serialize ( & mut ser) . unwrap ( ) ;
285285 assert_eq ! (
@@ -295,7 +295,7 @@ fn nested_struct() {
295295
296296 let node = NestedStruct {
297297 nested : Nested { float : 42.0 } ,
298- string : "answer" . to_string ( ) ,
298+ string : "answer" ,
299299 } ;
300300 node. serialize ( & mut ser) . unwrap ( ) ;
301301 assert_eq ! (
@@ -311,7 +311,7 @@ fn flatten_struct() {
311311
312312 let node = FlattenStruct {
313313 nested : Nested { float : 42.0 } ,
314- string : "answer" . to_string ( ) ,
314+ string : "answer" ,
315315 } ;
316316 node. serialize ( & mut ser) . unwrap ( ) ;
317317 assert_eq ! (
@@ -367,7 +367,7 @@ mod enum_ {
367367
368368 let node = ExternallyTagged :: Struct {
369369 float : 42.0 ,
370- string : "answer" . to_string ( ) ,
370+ string : "answer" ,
371371 } ;
372372 node. serialize ( & mut ser) . unwrap ( ) ;
373373 assert_eq ! (
@@ -381,7 +381,7 @@ mod enum_ {
381381 let mut buffer = Vec :: new ( ) ;
382382 let mut ser = Serializer :: with_root ( Writer :: new ( & mut buffer) , Some ( "root" ) ) ;
383383
384- let node = ExternallyTagged :: Tuple ( 42.0 , "answer" . to_string ( ) ) ;
384+ let node = ExternallyTagged :: Tuple ( 42.0 , "answer" ) ;
385385 node. serialize ( & mut ser) . unwrap ( ) ;
386386 assert_eq ! (
387387 String :: from_utf8( buffer) . unwrap( ) ,
@@ -396,7 +396,7 @@ mod enum_ {
396396
397397 let node = ExternallyTagged :: Holder {
398398 nested : Nested { float : 42.0 } ,
399- string : "answer" . to_string ( ) ,
399+ string : "answer" ,
400400 } ;
401401 node. serialize ( & mut ser) . unwrap ( ) ;
402402 assert_eq ! (
@@ -412,7 +412,7 @@ mod enum_ {
412412
413413 let node = ExternallyTagged :: Flatten {
414414 nested : Nested { float : 42.0 } ,
415- string : "answer" . to_string ( ) ,
415+ string : "answer" ,
416416 } ;
417417 node. serialize ( & mut ser) . unwrap ( ) ;
418418 assert_eq ! (
@@ -456,7 +456,7 @@ mod enum_ {
456456
457457 let node = InternallyTagged :: Struct {
458458 float : 42.0 ,
459- string : "answer" . to_string ( ) ,
459+ string : "answer" ,
460460 } ;
461461 node. serialize ( & mut ser) . unwrap ( ) ;
462462 assert_eq ! (
@@ -472,7 +472,7 @@ mod enum_ {
472472
473473 let node = InternallyTagged :: Holder {
474474 nested : Nested { float : 42.0 } ,
475- string : "answer" . to_string ( ) ,
475+ string : "answer" ,
476476 } ;
477477 node. serialize ( & mut ser) . unwrap ( ) ;
478478 assert_eq ! (
@@ -488,7 +488,7 @@ mod enum_ {
488488
489489 let node = InternallyTagged :: Flatten {
490490 nested : Nested { float : 42.0 } ,
491- string : "answer" . to_string ( ) ,
491+ string : "answer" ,
492492 } ;
493493 node. serialize ( & mut ser) . unwrap ( ) ;
494494 assert_eq ! (
@@ -530,7 +530,7 @@ mod enum_ {
530530 let mut buffer = Vec :: new ( ) ;
531531 let mut ser = Serializer :: with_root ( Writer :: new ( & mut buffer) , Some ( "root" ) ) ;
532532
533- let node = AdjacentlyTagged :: Tuple ( 42.0 , "answer" . to_string ( ) ) ;
533+ let node = AdjacentlyTagged :: Tuple ( 42.0 , "answer" ) ;
534534 node. serialize ( & mut ser) . unwrap ( ) ;
535535 assert_eq ! (
536536 String :: from_utf8( buffer) . unwrap( ) ,
@@ -545,7 +545,7 @@ mod enum_ {
545545
546546 let node = AdjacentlyTagged :: Struct {
547547 float : 42.0 ,
548- string : "answer" . to_string ( ) ,
548+ string : "answer" ,
549549 } ;
550550 node. serialize ( & mut ser) . unwrap ( ) ;
551551 assert_eq ! (
@@ -561,7 +561,7 @@ mod enum_ {
561561
562562 let node = AdjacentlyTagged :: Holder {
563563 nested : Nested { float : 42.0 } ,
564- string : "answer" . to_string ( ) ,
564+ string : "answer" ,
565565 } ;
566566 node. serialize ( & mut ser) . unwrap ( ) ;
567567 assert_eq ! (
@@ -577,7 +577,7 @@ mod enum_ {
577577
578578 let node = AdjacentlyTagged :: Flatten {
579579 nested : Nested { float : 42.0 } ,
580- string : "answer" . to_string ( ) ,
580+ string : "answer" ,
581581 } ;
582582 node. serialize ( & mut ser) . unwrap ( ) ;
583583 assert_eq ! (
@@ -618,7 +618,7 @@ mod enum_ {
618618 let mut buffer = Vec :: new ( ) ;
619619 let mut ser = Serializer :: with_root ( Writer :: new ( & mut buffer) , Some ( "root" ) ) ;
620620
621- let node = Untagged :: Tuple ( 42.0 , "answer" . to_string ( ) ) ;
621+ let node = Untagged :: Tuple ( 42.0 , "answer" ) ;
622622 node. serialize ( & mut ser) . unwrap ( ) ;
623623 assert_eq ! (
624624 String :: from_utf8( buffer) . unwrap( ) ,
@@ -633,7 +633,7 @@ mod enum_ {
633633
634634 let node = Untagged :: Struct {
635635 float : 42.0 ,
636- string : "answer" . to_string ( ) ,
636+ string : "answer" ,
637637 } ;
638638 node. serialize ( & mut ser) . unwrap ( ) ;
639639 assert_eq ! (
@@ -649,7 +649,7 @@ mod enum_ {
649649
650650 let node = Untagged :: Holder {
651651 nested : Nested { float : 42.0 } ,
652- string : "answer" . to_string ( ) ,
652+ string : "answer" ,
653653 } ;
654654 node. serialize ( & mut ser) . unwrap ( ) ;
655655 assert_eq ! (
@@ -665,7 +665,7 @@ mod enum_ {
665665
666666 let node = Untagged :: Flatten {
667667 nested : Nested { float : 42.0 } ,
668- string : "answer" . to_string ( ) ,
668+ string : "answer" ,
669669 } ;
670670 node. serialize ( & mut ser) . unwrap ( ) ;
671671 assert_eq ! (
0 commit comments