From 590feb1c7145bc2bca926241e14d00f066fadf90 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 15 Oct 2018 16:46:42 -0400 Subject: [PATCH] Format --- src/flags.rs | 6 ++---- src/isolate.rs | 9 +++------ src/ops.rs | 12 ++++++------ tools/deno_dir_test.py | 4 +++- tools/unit_tests.py | 6 +++--- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/flags.rs b/src/flags.rs index aba4f8f14c..f93b8262e9 100644 --- a/src/flags.rs +++ b/src/flags.rs @@ -209,8 +209,7 @@ fn v8_set_flags_preprocess(args: Vec) -> (Vec, Vec) { } true - }) - .collect(); + }).collect(); // Replace args being sent to V8 for idx in 0..args.len() { @@ -279,7 +278,6 @@ pub fn v8_set_flags(args: Vec) -> Vec { let cstr = CStr::from_ptr(*ptr as *const i8); let slice = cstr.to_str().unwrap(); slice.to_string() - }) - .chain(rest.into_iter()) + }).chain(rest.into_iter()) .collect() } diff --git a/src/isolate.rs b/src/isolate.rs index c19cd7cb14..0adfdb8845 100644 --- a/src/isolate.rs +++ b/src/isolate.rs @@ -372,8 +372,7 @@ mod tests { throw Error("assert error"); } "#, - ) - .expect("execute error"); + ).expect("execute error"); isolate.event_loop(); }); } @@ -418,8 +417,7 @@ mod tests { const data = new Uint8Array([42, 43, 44, 45, 46]); libdeno.send(control, data); "#, - ) - .expect("execute error"); + ).expect("execute error"); isolate.event_loop(); let metrics = isolate.state.metrics.lock().unwrap(); assert_eq!(metrics.ops_dispatched, 1); @@ -455,8 +453,7 @@ mod tests { let r = libdeno.send(control, data); if (r != null) throw Error("expected null"); "#, - ) - .expect("execute error"); + ).expect("execute error"); // Make sure relevant metrics are updated before task is executed. { diff --git a/src/ops.rs b/src/ops.rs index f86e46da7b..53ed85b7f0 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -113,7 +113,8 @@ pub fn dispatch( op_creator(isolate.state.clone(), &base, data) }; - let boxed_op = Box::new(op.or_else(move |err: DenoError| -> DenoResult { + let boxed_op = Box::new( + op.or_else(move |err: DenoError| -> DenoResult { debug!("op err {}", err); // No matter whether we got an Err or Ok, we want a serialized message to // send back. So transform the DenoError into a deno_buf. @@ -145,7 +146,8 @@ pub fn dispatch( ) }; Ok(buf) - })); + }), + ); debug!( "msg_from_js {} sync {}", @@ -367,8 +369,7 @@ fn op_env( ..Default::default() }, ) - }) - .collect(); + }).collect(); let tables = builder.create_vector(&vars); let inner = msg::EnvironRes::create( builder, @@ -948,8 +949,7 @@ fn op_read_dir( ..Default::default() }, ) - }) - .collect(); + }).collect(); let entries = builder.create_vector(&entries); let inner = msg::ReadDirRes::create( diff --git a/tools/deno_dir_test.py b/tools/deno_dir_test.py index 571914fc63..7ca22f9dd5 100755 --- a/tools/deno_dir_test.py +++ b/tools/deno_dir_test.py @@ -6,6 +6,7 @@ import subprocess import sys from util import rmtree, run + def deno_dir_test(deno_exe, deno_dir): assert os.path.isfile(deno_exe) @@ -29,7 +30,7 @@ def deno_dir_test(deno_exe, deno_dir): rmtree(deno_dir) if old_deno_dir is not None: - os.environ["DENO_DIR"] = old_deno_dir + os.environ["DENO_DIR"] = old_deno_dir def run_deno(deno_exe, deno_dir=None): @@ -37,6 +38,7 @@ def run_deno(deno_exe, deno_dir=None): deno_dir_env = {"DENO_DIR": deno_dir} if deno_dir is not None else None run(cmd, quiet=True, env=deno_dir_env) + def main(argv): if len(sys.argv) != 3: print "Usage ./tools/deno_dir_test.py out/debug/deno out/debug/.deno_dir" diff --git a/tools/unit_tests.py b/tools/unit_tests.py index 14f1d18b76..78b4d77c13 100755 --- a/tools/unit_tests.py +++ b/tools/unit_tests.py @@ -4,6 +4,7 @@ import sys import subprocess import re + def run_unit_test2(cmd): process = subprocess.Popen( cmd, @@ -26,6 +27,7 @@ def run_unit_test2(cmd): if errcode != 0: sys.exit(errcode) + def run_unit_test(deno_exe, permStr, flags=[]): cmd = [deno_exe, "--reload", "js/unit_tests.ts", permStr] + flags run_unit_test2(cmd) @@ -48,9 +50,7 @@ def unit_tests(deno_exe): # These are not strictly unit tests for Deno, but for ts_library_builder. # They run under Node, but use the same //js/testing/ library. run_unit_test2([ - "node", - "./node_modules/.bin/ts-node", - "--project", + "node", "./node_modules/.bin/ts-node", "--project", "tools/ts_library_builder/tsconfig.json", "tools/ts_library_builder/test.ts" ])