about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/main.rs')
-rw-r--r--users/tazjin/rlox/src/main.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs
index 2d8cf4f354..ee61ae01a1 100644
--- a/users/tazjin/rlox/src/main.rs
+++ b/users/tazjin/rlox/src/main.rs
@@ -1,8 +1,5 @@
-use std::env;
-use std::fs;
-use std::io;
 use std::io::Write;
-use std::process;
+use std::{env, fs, io, process};
 
 mod bytecode;
 mod scanner;
@@ -15,10 +12,7 @@ pub trait Lox {
     type Error: std::fmt::Display;
 
     fn create() -> Self;
-    fn interpret(
-        &mut self,
-        source: String,
-    ) -> Result<Self::Value, Vec<Self::Error>>;
+    fn interpret(&mut self, source: String) -> Result<Self::Value, Vec<Self::Error>>;
 }
 
 fn main() {
@@ -29,9 +23,7 @@ fn main() {
     }
 
     match env::var("LOX_INTERPRETER").as_ref().map(String::as_str) {
-        Ok("treewalk") => {
-            pick::<treewalk::interpreter::Interpreter>(args.nth(1))
-        }
+        Ok("treewalk") => pick::<treewalk::interpreter::Interpreter>(args.nth(1)),
         _ => pick::<bytecode::Interpreter>(args.nth(1)),
     }
 }
@@ -46,8 +38,7 @@ fn pick<I: Lox>(file_arg: Option<String>) {
 
 // Run Lox code from a file and print results to stdout
 fn run_file<I: Lox>(file: &str) {
-    let contents =
-        fs::read_to_string(file).expect("failed to read the input file");
+    let contents = fs::read_to_string(file).expect("failed to read the input file");
     let mut lox = I::create();
     run(&mut lox, contents);
 }