@@ -626,9 +626,9 @@ impl FieldNamePart {
626626
627627#[ derive( Debug , PartialEq ) ]
628628pub ( crate ) enum FieldType {
629- AutoSpec ,
630- IndexSpec ( usize ) ,
631- KeywordSpec ( String ) ,
629+ Auto ,
630+ Index ( usize ) ,
631+ Keyword ( String ) ,
632632}
633633
634634#[ derive( Debug , PartialEq ) ]
@@ -646,11 +646,11 @@ impl FieldName {
646646 }
647647
648648 let field_type = if first. is_empty ( ) {
649- FieldType :: AutoSpec
649+ FieldType :: Auto
650650 } else if let Ok ( index) = first. parse :: < usize > ( ) {
651- FieldType :: IndexSpec ( index)
651+ FieldType :: Index ( index)
652652 } else {
653- FieldType :: KeywordSpec ( first)
653+ FieldType :: Keyword ( first)
654654 } ;
655655
656656 let mut parts = Vec :: new ( ) ;
@@ -846,7 +846,7 @@ impl FormatString {
846846 let mut auto_argument_index: usize = 0 ;
847847 let mut seen_index = false ;
848848 self . format_internal ( vm, & mut |field_type| match field_type {
849- FieldType :: AutoSpec => {
849+ FieldType :: Auto => {
850850 if seen_index {
851851 return Err ( vm. new_value_error (
852852 "cannot switch from manual field specification to automatic field numbering"
@@ -860,7 +860,7 @@ impl FormatString {
860860 . cloned ( )
861861 . ok_or_else ( || vm. new_index_error ( "tuple index out of range" . to_owned ( ) ) )
862862 }
863- FieldType :: IndexSpec ( index) => {
863+ FieldType :: Index ( index) => {
864864 if auto_argument_index != 0 {
865865 return Err ( vm. new_value_error (
866866 "cannot switch from automatic field numbering to manual field specification"
@@ -874,18 +874,18 @@ impl FormatString {
874874 . cloned ( )
875875 . ok_or_else ( || vm. new_index_error ( "tuple index out of range" . to_owned ( ) ) )
876876 }
877- FieldType :: KeywordSpec ( keyword) => arguments
877+ FieldType :: Keyword ( keyword) => arguments
878878 . get_optional_kwarg ( & keyword)
879879 . ok_or_else ( || vm. new_key_error ( vm. new_str ( keyword. to_owned ( ) ) ) ) ,
880880 } )
881881 }
882882
883883 pub ( crate ) fn format_map ( & self , dict : & PyObjectRef , vm : & VirtualMachine ) -> PyResult < String > {
884884 self . format_internal ( vm, & mut |field_type| match field_type {
885- FieldType :: AutoSpec | FieldType :: IndexSpec ( _) => {
885+ FieldType :: Auto | FieldType :: Index ( _) => {
886886 Err ( vm. new_value_error ( "Format string contains positional fields" . to_owned ( ) ) )
887887 }
888- FieldType :: KeywordSpec ( keyword) => dict. get_item ( keyword, & vm) ,
888+ FieldType :: Keyword ( keyword) => dict. get_item ( keyword, & vm) ,
889889 } )
890890 }
891891}
@@ -896,7 +896,7 @@ fn call_object_format(
896896 preconversion_spec : Option < char > ,
897897 format_spec : & str ,
898898) -> PyResult {
899- let argument = match preconversion_spec. and_then ( |c| FormatPreconversor :: from_char ( c ) ) {
899+ let argument = match preconversion_spec. and_then ( FormatPreconversor :: from_char) {
900900 Some ( FormatPreconversor :: Str ) => vm. call_method ( & argument, "__str__" , vec ! [ ] ) ?,
901901 Some ( FormatPreconversor :: Repr ) => vm. call_method ( & argument, "__repr__" , vec ! [ ] ) ?,
902902 Some ( FormatPreconversor :: Ascii ) => vm. call_method ( & argument, "__repr__" , vec ! [ ] ) ?,
@@ -1126,28 +1126,28 @@ mod tests {
11261126 assert_eq ! (
11271127 FieldName :: parse( "" ) ,
11281128 Ok ( FieldName {
1129- field_type: FieldType :: AutoSpec ,
1129+ field_type: FieldType :: Auto ,
11301130 parts: Vec :: new( ) ,
11311131 } )
11321132 ) ;
11331133 assert_eq ! (
11341134 FieldName :: parse( "0" ) ,
11351135 Ok ( FieldName {
1136- field_type: FieldType :: IndexSpec ( 0 ) ,
1136+ field_type: FieldType :: Index ( 0 ) ,
11371137 parts: Vec :: new( ) ,
11381138 } )
11391139 ) ;
11401140 assert_eq ! (
11411141 FieldName :: parse( "key" ) ,
11421142 Ok ( FieldName {
1143- field_type: FieldType :: KeywordSpec ( "key" . to_owned( ) ) ,
1143+ field_type: FieldType :: Keyword ( "key" . to_owned( ) ) ,
11441144 parts: Vec :: new( ) ,
11451145 } )
11461146 ) ;
11471147 assert_eq ! (
11481148 FieldName :: parse( "key.attr[0][string]" ) ,
11491149 Ok ( FieldName {
1150- field_type: FieldType :: KeywordSpec ( "key" . to_owned( ) ) ,
1150+ field_type: FieldType :: Keyword ( "key" . to_owned( ) ) ,
11511151 parts: vec![
11521152 FieldNamePart :: Attribute ( "attr" . to_owned( ) ) ,
11531153 FieldNamePart :: Index ( 0 ) ,
0 commit comments