@@ -88,7 +88,7 @@ fn with_compiler(
8888) -> Result < CodeObject , CompileError > {
8989 let mut compiler = Compiler :: new ( optimize) ;
9090 compiler. source_path = Some ( source_path) ;
91- compiler. push_new_code_object ( "<module>" . to_string ( ) ) ;
91+ compiler. push_new_code_object ( "<module>" . to_owned ( ) ) ;
9292 f ( & mut compiler) ?;
9393 let code = compiler. pop_code_object ( ) ;
9494 trace ! ( "Compilation completed: {:?}" , code) ;
@@ -897,7 +897,7 @@ impl<O: OutputStream> Compiler<O> {
897897 // key:
898898 self . emit ( Instruction :: LoadConst {
899899 value : bytecode:: Constant :: String {
900- value : "return" . to_string ( ) ,
900+ value : "return" . to_owned ( ) ,
901901 } ,
902902 } ) ;
903903 // value:
@@ -989,11 +989,11 @@ impl<O: OutputStream> Compiler<O> {
989989 let ( new_body, doc_str) = get_doc ( body) ;
990990
991991 self . emit ( Instruction :: LoadName {
992- name : "__name__" . to_string ( ) ,
992+ name : "__name__" . to_owned ( ) ,
993993 scope : bytecode:: NameScope :: Global ,
994994 } ) ;
995995 self . emit ( Instruction :: StoreName {
996- name : "__module__" . to_string ( ) ,
996+ name : "__module__" . to_owned ( ) ,
997997 scope : bytecode:: NameScope :: Free ,
998998 } ) ;
999999 self . emit ( Instruction :: LoadConst {
@@ -1002,7 +1002,7 @@ impl<O: OutputStream> Compiler<O> {
10021002 } ,
10031003 } ) ;
10041004 self . emit ( Instruction :: StoreName {
1005- name : "__qualname__" . to_string ( ) ,
1005+ name : "__qualname__" . to_owned ( ) ,
10061006 scope : bytecode:: NameScope :: Free ,
10071007 } ) ;
10081008 self . compile_statements ( new_body) ?;
@@ -1090,7 +1090,7 @@ impl<O: OutputStream> Compiler<O> {
10901090
10911091 self . emit ( Instruction :: Rotate { amount : 2 } ) ;
10921092 self . emit ( Instruction :: StoreAttr {
1093- name : "__doc__" . to_string ( ) ,
1093+ name : "__doc__" . to_owned ( ) ,
10941094 } ) ;
10951095 }
10961096
@@ -1171,7 +1171,7 @@ impl<O: OutputStream> Compiler<O> {
11711171 self . set_label ( check_asynciter_label) ;
11721172 self . emit ( Instruction :: Duplicate ) ;
11731173 self . emit ( Instruction :: LoadName {
1174- name : "StopAsyncIteration" . to_string ( ) ,
1174+ name : "StopAsyncIteration" . to_owned ( ) ,
11751175 scope : bytecode:: NameScope :: Global ,
11761176 } ) ;
11771177 self . emit ( Instruction :: CompareOperation {
@@ -1732,7 +1732,7 @@ impl<O: OutputStream> Compiler<O> {
17321732 func : FunctionContext :: Function ,
17331733 } ;
17341734
1735- let name = "<lambda>" . to_string ( ) ;
1735+ let name = "<lambda>" . to_owned ( ) ;
17361736 self . enter_function ( & name, args) ?;
17371737 self . compile_expression ( body) ?;
17381738 self . emit ( Instruction :: ReturnValue ) ;
@@ -1933,7 +1933,7 @@ impl<O: OutputStream> Compiler<O> {
19331933 // Create magnificent function <listcomp>:
19341934 self . push_output ( CodeObject :: new (
19351935 Default :: default ( ) ,
1936- vec ! [ ".0" . to_string ( ) ] ,
1936+ vec ! [ ".0" . to_owned ( ) ] ,
19371937 Varargs :: None ,
19381938 vec ! [ ] ,
19391939 Varargs :: None ,
@@ -2264,8 +2264,8 @@ mod tests {
22642264
22652265 fn compile_exec ( source : & str ) -> CodeObject {
22662266 let mut compiler: Compiler = Default :: default ( ) ;
2267- compiler. source_path = Some ( "source_path" . to_string ( ) ) ;
2268- compiler. push_new_code_object ( "<module>" . to_string ( ) ) ;
2267+ compiler. source_path = Some ( "source_path" . to_owned ( ) ) ;
2268+ compiler. push_new_code_object ( "<module>" . to_owned ( ) ) ;
22692269 let ast = parser:: parse_program ( & source. to_string ( ) ) . unwrap ( ) ;
22702270 let symbol_scope = make_symbol_table ( & ast) . unwrap ( ) ;
22712271 compiler. compile_program ( & ast, symbol_scope) . unwrap ( ) ;
0 commit comments