@@ -290,15 +290,15 @@ impl<O: OutputStream> Compiler<O> {
290290 fn load_name ( & mut self , name : & str ) {
291291 let scope = self . scope_for_name ( name) ;
292292 self . emit ( Instruction :: LoadName {
293- name : name. to_string ( ) ,
293+ name : name. to_owned ( ) ,
294294 scope,
295295 } ) ;
296296 }
297297
298298 fn store_name ( & mut self , name : & str ) {
299299 let scope = self . scope_for_name ( name) ;
300300 self . emit ( Instruction :: StoreName {
301- name : name. to_string ( ) ,
301+ name : name. to_owned ( ) ,
302302 scope,
303303 } ) ;
304304 }
@@ -359,7 +359,7 @@ impl<O: OutputStream> Compiler<O> {
359359 for name in names {
360360 // import symbol from module:
361361 self . emit ( Instruction :: ImportFrom {
362- name : name. symbol . to_string ( ) ,
362+ name : name. symbol . to_owned ( ) ,
363363 } ) ;
364364
365365 // Store module under proper name:
@@ -619,13 +619,13 @@ impl<O: OutputStream> Compiler<O> {
619619 match & expression. node {
620620 ast:: ExpressionType :: Identifier { name } => {
621621 self . emit ( Instruction :: DeleteName {
622- name : name. to_string ( ) ,
622+ name : name. to_owned ( ) ,
623623 } ) ;
624624 }
625625 ast:: ExpressionType :: Attribute { value, name } => {
626626 self . compile_expression ( value) ?;
627627 self . emit ( Instruction :: DeleteAttr {
628- name : name. to_string ( ) ,
628+ name : name. to_owned ( ) ,
629629 } ) ;
630630 }
631631 ast:: ExpressionType :: Subscript { a, b } => {
@@ -701,7 +701,7 @@ impl<O: OutputStream> Compiler<O> {
701701 compile_varargs ( & args. kwarg ) ,
702702 self . source_path . clone ( ) . unwrap ( ) ,
703703 line_number,
704- name. to_string ( ) ,
704+ name. to_owned ( ) ,
705705 ) ) ;
706706 self . enter_scope ( ) ;
707707
@@ -909,7 +909,7 @@ impl<O: OutputStream> Compiler<O> {
909909 if let Some ( annotation) = & arg. annotation {
910910 self . emit ( Instruction :: LoadConst {
911911 value : bytecode:: Constant :: String {
912- value : arg. arg . to_string ( ) ,
912+ value : arg. arg . to_owned ( ) ,
913913 } ,
914914 } ) ;
915915 self . compile_expression ( & annotation) ?;
@@ -982,7 +982,7 @@ impl<O: OutputStream> Compiler<O> {
982982 Varargs :: None ,
983983 self . source_path . clone ( ) . unwrap ( ) ,
984984 line_number,
985- name. to_string ( ) ,
985+ name. to_owned ( ) ,
986986 ) ) ;
987987 self . enter_scope ( ) ;
988988
@@ -1022,7 +1022,7 @@ impl<O: OutputStream> Compiler<O> {
10221022 } ) ;
10231023 self . emit ( Instruction :: LoadConst {
10241024 value : bytecode:: Constant :: String {
1025- value : name. to_string ( ) ,
1025+ value : name. to_owned ( ) ,
10261026 } ,
10271027 } ) ;
10281028
@@ -1044,7 +1044,7 @@ impl<O: OutputStream> Compiler<O> {
10441044 for keyword in keywords {
10451045 if let Some ( name) = & keyword. name {
10461046 kwarg_names. push ( bytecode:: Constant :: String {
1047- value : name. to_string ( ) ,
1047+ value : name. to_owned ( ) ,
10481048 } ) ;
10491049 } else {
10501050 // This means **kwargs!
@@ -1308,7 +1308,7 @@ impl<O: OutputStream> Compiler<O> {
13081308 } ) ;
13091309 self . emit ( Instruction :: LoadConst {
13101310 value : bytecode:: Constant :: String {
1311- value : name. to_string ( ) ,
1311+ value : name. to_owned ( ) ,
13121312 } ,
13131313 } ) ;
13141314 self . emit ( Instruction :: StoreSubscript ) ;
@@ -1332,7 +1332,7 @@ impl<O: OutputStream> Compiler<O> {
13321332 ast:: ExpressionType :: Attribute { value, name } => {
13331333 self . compile_expression ( value) ?;
13341334 self . emit ( Instruction :: StoreAttr {
1335- name : name. to_string ( ) ,
1335+ name : name. to_owned ( ) ,
13361336 } ) ;
13371337 }
13381338 ast:: ExpressionType :: List { elements } | ast:: ExpressionType :: Tuple { elements } => {
@@ -1605,7 +1605,7 @@ impl<O: OutputStream> Compiler<O> {
16051605 Attribute { value, name } => {
16061606 self . compile_expression ( value) ?;
16071607 self . emit ( Instruction :: LoadAttr {
1608- name : name. to_string ( ) ,
1608+ name : name. to_owned ( ) ,
16091609 } ) ;
16101610 }
16111611 Compare { vals, ops } => {
@@ -1795,7 +1795,7 @@ impl<O: OutputStream> Compiler<O> {
17951795 if let Some ( name) = & keyword. name {
17961796 self . emit ( Instruction :: LoadConst {
17971797 value : bytecode:: Constant :: String {
1798- value : name. to_string ( ) ,
1798+ value : name. to_owned ( ) ,
17991799 } ,
18001800 } ) ;
18011801 self . compile_expression ( & keyword. value ) ?;
@@ -1858,7 +1858,7 @@ impl<O: OutputStream> Compiler<O> {
18581858 for keyword in keywords {
18591859 if let Some ( name) = & keyword. name {
18601860 kwarg_names. push ( bytecode:: Constant :: String {
1861- value : name. to_string ( ) ,
1861+ value : name. to_owned ( ) ,
18621862 } ) ;
18631863 } else {
18641864 // This means **kwargs!
@@ -1927,7 +1927,7 @@ impl<O: OutputStream> Compiler<O> {
19271927 ast:: ComprehensionKind :: Set { .. } => "<setcomp>" ,
19281928 ast:: ComprehensionKind :: Dict { .. } => "<dictcomp>" ,
19291929 }
1930- . to_string ( ) ;
1930+ . to_owned ( ) ;
19311931
19321932 let line_number = self . get_source_line_number ( ) ;
19331933 // Create magnificent function <listcomp>:
@@ -2099,7 +2099,7 @@ impl<O: OutputStream> Compiler<O> {
20992099 ast:: StringGroup :: Constant { value } => {
21002100 self . emit ( Instruction :: LoadConst {
21012101 value : bytecode:: Constant :: String {
2102- value : value. to_string ( ) ,
2102+ value : value. to_owned ( ) ,
21032103 } ,
21042104 } ) ;
21052105 }
@@ -2266,7 +2266,7 @@ mod tests {
22662266 let mut compiler: Compiler = Default :: default ( ) ;
22672267 compiler. source_path = Some ( "source_path" . to_owned ( ) ) ;
22682268 compiler. push_new_code_object ( "<module>" . to_owned ( ) ) ;
2269- let ast = parser:: parse_program ( & source. to_string ( ) ) . unwrap ( ) ;
2269+ let ast = parser:: parse_program ( source) . unwrap ( ) ;
22702270 let symbol_scope = make_symbol_table ( & ast) . unwrap ( ) ;
22712271 compiler. compile_program ( & ast, symbol_scope) . unwrap ( ) ;
22722272 compiler. pop_code_object ( )
0 commit comments