about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/main.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-02-07T16·29+0300
committerclbot <clbot@tvl.fyi>2022-02-07T16·58+0000
commit0d0b43ed8819e66a0888eb6d1d1f47b171ae62e0 (patch)
tree305c04d3fe26c92ed7037f0b0f41f38444ce83ea /users/tazjin/rlox/src/main.rs
parent8b8c98380e85b2057a3c35ce3d76879fab4266b0 (diff)
fix(users/tazjin): rustfmt code with non-default settings r/3776
rustfmt only sometimes detects path-based nested config
files (probably some kind of race?), so my users folder uses a
separate formatting check for rustfmt to avoid flaky CI. Enough flakes
around already ...

Change-Id: Ifd862f9974f071b3a256643dd8e56c019116156a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5242
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
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 2d8cf4f354ea..ee61ae01a106 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);
 }