@@ -51,26 +51,26 @@ fn main() {
5151 . get_matches ( ) ;
5252
5353 // Construct vm:
54- let mut vm = VirtualMachine :: new ( ) ;
54+ let vm = VirtualMachine :: new ( ) ;
5555
5656 // Figure out if a -c option was given:
5757 let result = if let Some ( command) = matches. value_of ( "c" ) {
58- run_command ( & mut vm, command. to_string ( ) )
58+ run_command ( & vm, command. to_string ( ) )
5959 } else if let Some ( module) = matches. value_of ( "m" ) {
60- run_module ( & mut vm, module)
60+ run_module ( & vm, module)
6161 } else {
6262 // Figure out if a script was passed:
6363 match matches. value_of ( "script" ) {
64- None => run_shell ( & mut vm) ,
65- Some ( filename) => run_script ( & mut vm, filename) ,
64+ None => run_shell ( & vm) ,
65+ Some ( filename) => run_script ( & vm, filename) ,
6666 }
6767 } ;
6868
6969 // See if any exception leaked out:
70- handle_exception ( & mut vm, result) ;
70+ handle_exception ( & vm, result) ;
7171}
7272
73- fn _run_string ( vm : & mut VirtualMachine , source : & str , source_path : String ) -> PyResult {
73+ fn _run_string ( vm : & VirtualMachine , source : & str , source_path : String ) -> PyResult {
7474 let code_obj = compile:: compile (
7575 source,
7676 & compile:: Mode :: Exec ,
@@ -86,28 +86,28 @@ fn _run_string(vm: &mut VirtualMachine, source: &str, source_path: String) -> Py
8686 vm. run_code_obj ( code_obj, vars)
8787}
8888
89- fn handle_exception ( vm : & mut VirtualMachine , result : PyResult ) {
89+ fn handle_exception ( vm : & VirtualMachine , result : PyResult ) {
9090 if let Err ( err) = result {
9191 print_exception ( vm, & err) ;
9292 std:: process:: exit ( 1 ) ;
9393 }
9494}
9595
96- fn run_command ( vm : & mut VirtualMachine , mut source : String ) -> PyResult {
96+ fn run_command ( vm : & VirtualMachine , mut source : String ) -> PyResult {
9797 debug ! ( "Running command {}" , source) ;
9898
9999 // This works around https://github.com/RustPython/RustPython/issues/17
100100 source. push ( '\n' ) ;
101101 _run_string ( vm, & source, "<stdin>" . to_string ( ) )
102102}
103103
104- fn run_module ( vm : & mut VirtualMachine , module : & str ) -> PyResult {
104+ fn run_module ( vm : & VirtualMachine , module : & str ) -> PyResult {
105105 debug ! ( "Running module {}" , module) ;
106106 let current_path = PathBuf :: from ( "." ) ;
107107 import:: import_module ( vm, current_path, module)
108108}
109109
110- fn run_script ( vm : & mut VirtualMachine , script_file : & str ) -> PyResult {
110+ fn run_script ( vm : & VirtualMachine , script_file : & str ) -> PyResult {
111111 debug ! ( "Running file {}" , script_file) ;
112112 // Parse an ast from it:
113113 let file_path = Path :: new ( script_file) ;
@@ -120,7 +120,7 @@ fn run_script(vm: &mut VirtualMachine, script_file: &str) -> PyResult {
120120 }
121121}
122122
123- fn shell_exec ( vm : & mut VirtualMachine , source : & str , scope : Scope ) -> Result < ( ) , CompileError > {
123+ fn shell_exec ( vm : & VirtualMachine , source : & str , scope : Scope ) -> Result < ( ) , CompileError > {
124124 match compile:: compile (
125125 source,
126126 & compile:: Mode :: Single ,
@@ -159,7 +159,7 @@ fn get_history_path() -> PathBuf {
159159 xdg_dirs. place_cache_file ( "repl_history.txt" ) . unwrap ( )
160160}
161161
162- fn run_shell ( vm : & mut VirtualMachine ) -> PyResult {
162+ fn run_shell ( vm : & VirtualMachine ) -> PyResult {
163163 println ! (
164164 "Welcome to the magnificent Rust Python {} interpreter" ,
165165 crate_version!( )
0 commit comments