@@ -111,7 +111,7 @@ fn parse_definitions<'a>(
111111 Some ( "type" ) => types. push ( parse_type_definition ( id, line, def, & types) ?) ,
112112 Some ( "error" ) => errors. push ( parse_error_definition ( id, line, def, & types, & errors) ?) ,
113113 Some ( "func" ) => functions. push ( parse_function_definition ( id, line, def, & types, & functions) ?) ,
114- Some ( r#type) => return Err ( ParseError :: InvalidDefinitionType { line, desc : r#type. to_string ( ) } ) ,
114+ Some ( r#type) => return Err ( ParseError :: InvalidDefinitionType { line, desc : r#type. to_owned ( ) } ) ,
115115 None => return Err ( ParseError :: DefinitionTypeMissing { line } ) ,
116116 } ;
117117 }
@@ -134,7 +134,7 @@ fn parse_type_definition<'a>(
134134) -> Result < TypeDefinition , ParseError > {
135135 let name = def. next ( )
136136 . ok_or ( ParseError :: DefinitionNameMissing { line } ) ?
137- . to_string ( ) ;
137+ . to_owned ( ) ;
138138 if type_defined ( & name, type_definitions) {
139139 return Err ( ParseError :: DuplicateDefinition { line, desc : name } ) ;
140140 }
@@ -143,7 +143,7 @@ fn parse_type_definition<'a>(
143143
144144 let r#enum = def. next ( )
145145 . ok_or ( ParseError :: EnumMissing { line } ) ?
146- . to_string ( ) ;
146+ . to_owned ( ) ;
147147
148148 Ok ( TypeDefinition { id, name, fields, r#enum } )
149149}
@@ -157,7 +157,7 @@ fn parse_error_definition<'a>(
157157) -> Result < ErrorDefinition , ParseError > {
158158 let name = def. next ( )
159159 . ok_or ( ParseError :: DefinitionNameMissing { line } ) ?
160- . to_string ( ) ;
160+ . to_owned ( ) ;
161161 if error_defined ( & name, error_definitions) {
162162 return Err ( ParseError :: DuplicateDefinition { line, desc : name } ) ;
163163 }
@@ -177,7 +177,7 @@ fn parse_function_definition<'a>(
177177) -> Result < FunctionDefinition , ParseError > {
178178 let name = def. next ( )
179179 . ok_or ( ParseError :: DefinitionNameMissing { line } ) ?
180- . to_string ( ) ;
180+ . to_owned ( ) ;
181181 if function_defined ( & name, function_definitions) {
182182 return Err ( ParseError :: DuplicateDefinition { line, desc : name } ) ;
183183 }
@@ -207,7 +207,7 @@ fn parse_fields<'a>(
207207
208208 let name = part. next ( )
209209 . ok_or ( ParseError :: FieldNameMissing { line } ) ?
210- . to_string ( ) ;
210+ . to_owned ( ) ;
211211 if field_defined ( & name, & fields) {
212212 return Err ( ParseError :: DuplicateField { line, desc : name } ) ;
213213 }
@@ -253,8 +253,8 @@ fn parse_type(
253253 type_definitions,
254254 Some ( OuterType :: Option ) ,
255255 ) ?) ) ,
256- _ if enum_defined ( r#type, type_definitions) => Type :: Defined ( r#type. to_string ( ) ) ,
257- _ => return Err ( ParseError :: InvalidType { line, field : field. to_string ( ) , desc : r#type. to_string ( ) } ) ,
256+ _ if enum_defined ( r#type, type_definitions) => Type :: Defined ( r#type. to_owned ( ) ) ,
257+ _ => return Err ( ParseError :: InvalidType { line, field : field. to_owned ( ) , desc : r#type. to_owned ( ) } ) ,
258258 } ;
259259
260260 if let Some ( outer) = outer {
@@ -267,7 +267,7 @@ fn parse_type(
267267 ) {
268268 return Err ( ParseError :: InvalidType {
269269 line,
270- field : field. to_string ( ) ,
270+ field : field. to_owned ( ) ,
271271 desc : format ! ( "invalid nested type: {:?}<{:?}>" , outer, r#type) ,
272272 } ) ;
273273 }
0 commit comments