From 968344fba183e30d1d19154b5a6126233743155a Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Sat, 2 May 2015 16:56:46 +0200 Subject: [PATCH] pass single filename instead of full argument list to idem_check --- tests/idem.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/idem.rs b/tests/idem.rs index 72f3277f594..401e5fffcc6 100644 --- a/tests/idem.rs +++ b/tests/idem.rs @@ -39,7 +39,7 @@ fn idempotent_tests() { continue; } println!("Testing '{}'...", file_name); - match idempotent_check(vec!["rustfmt".to_owned(), file_name.to_owned()]) { + match idempotent_check(file_name.to_owned()) { Ok(()) => {}, Err(m) => { print_mismatches(m); @@ -50,7 +50,7 @@ fn idempotent_tests() { } // And also dogfood rustfmt! println!("Testing 'src/lib.rs'..."); - match idempotent_check(vec!["rustfmt".to_owned(), "src/lib.rs".to_owned()]) { + match idempotent_check("src/lib.rs".to_owned()) { Ok(()) => {}, Err(m) => { print_mismatches(m); @@ -75,10 +75,11 @@ fn print_mismatches(result: HashMap) { // Ick, just needed to get a &'static to handle_result. static HANDLE_RESULT: &'static Fn(HashMap) = &handle_result; -pub fn idempotent_check(args: Vec) -> Result<(), HashMap> { +pub fn idempotent_check(filename: String) -> Result<(), HashMap> { use std::thread; use std::fs; use std::io::Read; + let args = vec!["rustfmt".to_owned(), filename]; thread::spawn(move || { run(args, WriteMode::Return(HANDLE_RESULT)); }).join().map_err(|mut any|