diff options
Diffstat (limited to 'users/tazjin/rlox/src/main.rs')
-rw-r--r-- | users/tazjin/rlox/src/main.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs index 3a956833c15d..2b4e365d4125 100644 --- a/users/tazjin/rlox/src/main.rs +++ b/users/tazjin/rlox/src/main.rs @@ -15,7 +15,10 @@ 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() { @@ -26,7 +29,9 @@ 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)), } } @@ -41,7 +46,8 @@ 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); } |