2323
2424use std:: char;
2525use std:: str;
26+ use std:: string;
2627
2728/// A piece is a portion of the format string which represents the next part
2829/// to emit. These are emitted as a stream by the `Parser` class.
@@ -32,7 +33,7 @@ pub enum Piece<'a> {
3233 String ( & ' a str ) ,
3334 /// This describes that formatting should process the next argument (as
3435 /// specified inside) for emission.
35- Argument ( Argument < ' a > ) ,
36+ NextArgument ( Argument < ' a > ) ,
3637}
3738
3839/// Representation of an argument specification.
@@ -129,7 +130,7 @@ pub struct Parser<'a> {
129130 input : & ' a str ,
130131 cur : str:: CharOffsets < ' a > ,
131132 /// Error messages accumulated during parsing
132- pub errors : Vec < String > ,
133+ pub errors : Vec < string :: String > ,
133134}
134135
135136impl < ' a > Iterator < Piece < ' a > > for Parser < ' a > {
@@ -140,7 +141,7 @@ impl<'a> Iterator<Piece<'a>> for Parser<'a> {
140141 if self . consume ( '{' ) {
141142 Some ( String ( self . string ( pos + 1 ) ) )
142143 } else {
143- let ret = Some ( Argument ( self . argument ( ) ) ) ;
144+ let ret = Some ( NextArgument ( self . argument ( ) ) ) ;
144145 self . must_consume ( '}' ) ;
145146 ret
146147 }
@@ -469,28 +470,28 @@ mod tests {
469470
470471 #[ test]
471472 fn format_nothing ( ) {
472- same ( "{}" , [ Argument ( Argument {
473+ same ( "{}" , [ NextArgument ( Argument {
473474 position : ArgumentNext ,
474475 format : fmtdflt ( ) ,
475476 } ) ] ) ;
476477 }
477478 #[ test]
478479 fn format_position ( ) {
479- same ( "{3}" , [ Argument ( Argument {
480+ same ( "{3}" , [ NextArgument ( Argument {
480481 position : ArgumentIs ( 3 ) ,
481482 format : fmtdflt ( ) ,
482483 } ) ] ) ;
483484 }
484485 #[ test]
485486 fn format_position_nothing_else ( ) {
486- same ( "{3:}" , [ Argument ( Argument {
487+ same ( "{3:}" , [ NextArgument ( Argument {
487488 position : ArgumentIs ( 3 ) ,
488489 format : fmtdflt ( ) ,
489490 } ) ] ) ;
490491 }
491492 #[ test]
492493 fn format_type ( ) {
493- same ( "{3:a}" , [ Argument ( Argument {
494+ same ( "{3:a}" , [ NextArgument ( Argument {
494495 position : ArgumentIs ( 3 ) ,
495496 format : FormatSpec {
496497 fill : None ,
@@ -504,7 +505,7 @@ mod tests {
504505 }
505506 #[ test]
506507 fn format_align_fill ( ) {
507- same ( "{3:>}" , [ Argument ( Argument {
508+ same ( "{3:>}" , [ NextArgument ( Argument {
508509 position : ArgumentIs ( 3 ) ,
509510 format : FormatSpec {
510511 fill : None ,
@@ -515,7 +516,7 @@ mod tests {
515516 ty : "" ,
516517 } ,
517518 } ) ] ) ;
518- same ( "{3:0<}" , [ Argument ( Argument {
519+ same ( "{3:0<}" , [ NextArgument ( Argument {
519520 position : ArgumentIs ( 3 ) ,
520521 format : FormatSpec {
521522 fill : Some ( '0' ) ,
@@ -526,7 +527,7 @@ mod tests {
526527 ty : "" ,
527528 } ,
528529 } ) ] ) ;
529- same ( "{3:*<abcd}" , [ Argument ( Argument {
530+ same ( "{3:*<abcd}" , [ NextArgument ( Argument {
530531 position : ArgumentIs ( 3 ) ,
531532 format : FormatSpec {
532533 fill : Some ( '*' ) ,
@@ -540,7 +541,7 @@ mod tests {
540541 }
541542 #[ test]
542543 fn format_counts ( ) {
543- same ( "{:10s}" , [ Argument ( Argument {
544+ same ( "{:10s}" , [ NextArgument ( Argument {
544545 position : ArgumentNext ,
545546 format : FormatSpec {
546547 fill : None ,
@@ -551,7 +552,7 @@ mod tests {
551552 ty : "s" ,
552553 } ,
553554 } ) ] ) ;
554- same ( "{:10$.10s}" , [ Argument ( Argument {
555+ same ( "{:10$.10s}" , [ NextArgument ( Argument {
555556 position : ArgumentNext ,
556557 format : FormatSpec {
557558 fill : None ,
@@ -562,7 +563,7 @@ mod tests {
562563 ty : "s" ,
563564 } ,
564565 } ) ] ) ;
565- same ( "{:.*s}" , [ Argument ( Argument {
566+ same ( "{:.*s}" , [ NextArgument ( Argument {
566567 position : ArgumentNext ,
567568 format : FormatSpec {
568569 fill : None ,
@@ -573,7 +574,7 @@ mod tests {
573574 ty : "s" ,
574575 } ,
575576 } ) ] ) ;
576- same ( "{:.10$s}" , [ Argument ( Argument {
577+ same ( "{:.10$s}" , [ NextArgument ( Argument {
577578 position : ArgumentNext ,
578579 format : FormatSpec {
579580 fill : None ,
@@ -584,7 +585,7 @@ mod tests {
584585 ty : "s" ,
585586 } ,
586587 } ) ] ) ;
587- same ( "{:a$.b$s}" , [ Argument ( Argument {
588+ same ( "{:a$.b$s}" , [ NextArgument ( Argument {
588589 position : ArgumentNext ,
589590 format : FormatSpec {
590591 fill : None ,
@@ -598,7 +599,7 @@ mod tests {
598599 }
599600 #[ test]
600601 fn format_flags ( ) {
601- same ( "{:-}" , [ Argument ( Argument {
602+ same ( "{:-}" , [ NextArgument ( Argument {
602603 position : ArgumentNext ,
603604 format : FormatSpec {
604605 fill : None ,
@@ -609,7 +610,7 @@ mod tests {
609610 ty : "" ,
610611 } ,
611612 } ) ] ) ;
612- same ( "{:+#}" , [ Argument ( Argument {
613+ same ( "{:+#}" , [ NextArgument ( Argument {
613614 position : ArgumentNext ,
614615 format : FormatSpec {
615616 fill : None ,
@@ -623,7 +624,7 @@ mod tests {
623624 }
624625 #[ test]
625626 fn format_mixture ( ) {
626- same ( "abcd {3:a} efg" , [ String ( "abcd " ) , Argument ( Argument {
627+ same ( "abcd {3:a} efg" , [ String ( "abcd " ) , NextArgument ( Argument {
627628 position : ArgumentIs ( 3 ) ,
628629 format : FormatSpec {
629630 fill : None ,
0 commit comments