about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGilad Naaman <gilad.naaman@gmail.com>2017-12-15 17:32:00 +0200
committerGilad Naaman <gilad.naaman@gmail.com>2018-01-26 19:46:04 +0200
commit8b3fd98f4c12aca4e00f6cf2f00540182eef8a92 (patch)
treec86cd4276f8cc4294289fbe2cca0f060346ce48d /src
parent94bd1216bb735514118670878d28081f8493d1ac (diff)
downloadrust-8b3fd98f4c12aca4e00f6cf2f00540182eef8a92.tar.gz
rust-8b3fd98f4c12aca4e00f6cf2f00540182eef8a92.zip
libtest: rustfmt run
libtest: Whoops
Diffstat (limited to 'src')
-rw-r--r--src/libtest/formatters.rs178
-rw-r--r--src/libtest/lib.rs641
-rw-r--r--src/libtest/stats.rs504
3 files changed, 747 insertions, 576 deletions
diff --git a/src/libtest/formatters.rs b/src/libtest/formatters.rs
index f45ae3a7c2c..59228146e6b 100644
--- a/src/libtest/formatters.rs
+++ b/src/libtest/formatters.rs
@@ -14,10 +14,12 @@ pub(crate) trait OutputFormatter {
     fn write_run_start(&mut self, test_count: usize) -> io::Result<()>;
     fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()>;
     fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()>;
-    fn write_result(&mut self,
-                    desc: &TestDesc,
-                    result: &TestResult,
-                    stdout: &[u8]) -> io::Result<()>;
+    fn write_result(
+        &mut self,
+        desc: &TestDesc,
+        result: &TestResult,
+        stdout: &[u8],
+    ) -> io::Result<()>;
     fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool>;
 }
 
@@ -34,11 +36,13 @@ pub(crate) struct HumanFormatter<T> {
 }
 
 impl<T: Write> HumanFormatter<T> {
-    pub fn new(out: OutputLocation<T>,
-                use_color: bool,
-                terse: bool,
-                max_name_len: usize,
-                is_multithreaded: bool) -> Self {
+    pub fn new(
+        out: OutputLocation<T>,
+        use_color: bool,
+        terse: bool,
+        max_name_len: usize,
+        is_multithreaded: bool,
+    ) -> Self {
         HumanFormatter {
             out,
             terse,
@@ -74,8 +78,12 @@ impl<T: Write> HumanFormatter<T> {
         self.write_pretty("bench", term::color::CYAN)
     }
 
-    pub fn write_short_result(&mut self, verbose: &str, quiet: &str, color: term::color::Color)
-                              -> io::Result<()> {
+    pub fn write_short_result(
+        &mut self,
+        verbose: &str,
+        quiet: &str,
+        color: term::color::Color,
+    ) -> io::Result<()> {
         if self.terse {
             self.write_pretty(quiet, color)?;
             if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
@@ -182,11 +190,7 @@ impl<T: Write> HumanFormatter<T> {
 
 impl<T: Write> OutputFormatter for HumanFormatter<T> {
     fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
-        let noun = if test_count != 1 {
-            "tests"
-        } else {
-            "test"
-        };
+        let noun = if test_count != 1 { "tests" } else { "test" };
         self.write_plain(&format!("\nrunning {} {}\n", test_count, noun))
     }
 
@@ -224,9 +228,11 @@ impl<T: Write> OutputFormatter for HumanFormatter<T> {
             self.write_test_name(desc)?;
         }
 
-        self.write_plain(&format!("test {} has been running for over {} seconds\n",
-                                  desc.name,
-                                  TEST_WARN_TIMEOUT_S))
+        self.write_plain(&format!(
+            "test {} has been running for over {} seconds\n",
+            desc.name,
+            TEST_WARN_TIMEOUT_S
+        ))
     }
 
     fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
@@ -255,7 +261,8 @@ impl<T: Write> OutputFormatter for HumanFormatter<T> {
                 state.allowed_fail,
                 state.ignored,
                 state.measured,
-                state.filtered_out)
+                state.filtered_out
+            )
         } else {
             format!(
                 ". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
@@ -263,7 +270,8 @@ impl<T: Write> OutputFormatter for HumanFormatter<T> {
                 state.failed,
                 state.ignored,
                 state.measured,
-                state.filtered_out)
+                state.filtered_out
+            )
         };
 
         self.write_plain(&s)?;
@@ -273,7 +281,7 @@ impl<T: Write> OutputFormatter for HumanFormatter<T> {
 }
 
 pub(crate) struct JsonFormatter<T> {
-    out: OutputLocation<T>
+    out: OutputLocation<T>,
 }
 
 impl<T: Write> JsonFormatter<T> {
@@ -288,74 +296,83 @@ impl<T: Write> JsonFormatter<T> {
         self.out.write_all(b"\n")
     }
 
-    fn write_event(&mut self,
-                    ty: &str,
-                    name: &str,
-                    evt: &str,
-                    extra: Option<String>) -> io::Result<()> {
+    fn write_event(
+        &mut self,
+        ty: &str,
+        name: &str,
+        evt: &str,
+        extra: Option<String>,
+    ) -> io::Result<()> {
         if let Some(extras) = extra {
-            self.write_message(&*format!(r#"{{ "type": "{}", "name": "{}", "event": "{}", {} }}"#,
-                                    ty,
-                                    name,
-                                    evt,
-                                    extras))
-        }
-        else {
-            self.write_message(&*format!(r#"{{ "type": "{}", "name": "{}", "event": "{}" }}"#,
-                                    ty,
-                                    name,
-                                    evt))
+            self.write_message(&*format!(
+                r#"{{ "type": "{}", "name": "{}", "event": "{}", {} }}"#,
+                ty,
+                name,
+                evt,
+                extras
+            ))
+        } else {
+            self.write_message(&*format!(
+                r#"{{ "type": "{}", "name": "{}", "event": "{}" }}"#,
+                ty,
+                name,
+                evt
+            ))
         }
     }
 }
 
 impl<T: Write> OutputFormatter for JsonFormatter<T> {
     fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
-        self.write_message(
-            &*format!(r#"{{ "type": "suite", "event": "started", "test_count": "{}" }}"#,
-                        test_count))
+        self.write_message(&*format!(
+            r#"{{ "type": "suite", "event": "started", "test_count": "{}" }}"#,
+            test_count
+        ))
     }
 
     fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()> {
-        self.write_message(&*format!(r#"{{ "type": "test", "event": "started", "name": "{}" }}"#,
-                                desc.name))
+        self.write_message(&*format!(
+            r#"{{ "type": "test", "event": "started", "name": "{}" }}"#,
+            desc.name
+        ))
     }
 
-    fn write_result(&mut self,
-                        desc: &TestDesc,
-                        result: &TestResult,
-                        stdout: &[u8]) -> io::Result<()> {
+    fn write_result(
+        &mut self,
+        desc: &TestDesc,
+        result: &TestResult,
+        stdout: &[u8],
+    ) -> io::Result<()> {
         match *result {
-            TrOk => {
-                self.write_event("test", desc.name.as_slice(), "ok", None)
-            },
+            TrOk => self.write_event("test", desc.name.as_slice(), "ok", None),
 
             TrFailed => {
                 let extra_data = if stdout.len() > 0 {
-                    Some(format!(r#""stdout": "{}""#,
-                        EscapedString(String::from_utf8_lossy(stdout))))
-                }
-                else {
+                    Some(format!(
+                        r#""stdout": "{}""#,
+                        EscapedString(String::from_utf8_lossy(stdout))
+                    ))
+                } else {
                     None
                 };
 
                 self.write_event("test", desc.name.as_slice(), "failed", extra_data)
-            },
+            }
 
             TrFailedMsg(ref m) => {
-                self.write_event("test",
-                                    desc.name.as_slice(),
-                                    "failed",
-                                    Some(format!(r#""message": "{}""#, EscapedString(m))))
-            },
+                self.write_event(
+                    "test",
+                    desc.name.as_slice(),
+                    "failed",
+                    Some(format!(r#""message": "{}""#, EscapedString(m))),
+                )
+            }
 
-            TrIgnored => {
-                self.write_event("test", desc.name.as_slice(), "ignored", None)
-            },
+            TrIgnored => self.write_event("test", desc.name.as_slice(), "ignored", None),
 
             TrAllowedFail => {
                 self.write_event("test", desc.name.as_slice(), "allowed_failure", None)
-            },
+            }
 
             TrBench(ref bs) => {
                 let median = bs.ns_iter_summ.median as usize;
@@ -363,33 +380,37 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
 
                 let mbps = if bs.mb_s == 0 {
                     "".into()
-                }
-                else {
+                } else {
                     format!(r#", "mib_per_second": {}"#, bs.mb_s)
                 };
 
-                let line = format!("{{ \"type\": \"bench\", \
+                let line = format!(
+                    "{{ \"type\": \"bench\", \
                                 \"name\": \"{}\", \
                                 \"median\": {}, \
                                 \"deviation\": {}{} }}",
-                        desc.name,
-                        median,
-                        deviation,
-                        mbps);
+                    desc.name,
+                    median,
+                    deviation,
+                    mbps
+                );
 
                 self.write_message(&*line)
-            },
+            }
         }
     }
 
     fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
-        self.write_message(&*format!(r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#,
-                        desc.name))
+        self.write_message(&*format!(
+            r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#,
+            desc.name
+        ))
     }
 
     fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
 
-        self.write_message(&*format!("{{ \"type\": \"suite\", \
+        self.write_message(&*format!(
+            "{{ \"type\": \"suite\", \
             \"event\": \"{}\", \
             \"passed\": {}, \
             \"failed\": {}, \
@@ -403,7 +424,8 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
             state.allowed_fail,
             state.ignored,
             state.measured,
-            state.filtered_out))?;
+            state.filtered_out
+        ))?;
 
         Ok(state.failed == 0)
     }
@@ -454,7 +476,9 @@ impl<S: AsRef<str>> ::std::fmt::Display for EscapedString<S> {
                 b'\x1e' => "\\u001e",
                 b'\x1f' => "\\u001f",
                 b'\x7f' => "\\u007f",
-                _ => { continue; }
+                _ => {
+                    continue;
+                }
             };
 
             if start < i {
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 04c0734b524..4da89f5ab4b 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -240,10 +240,7 @@ pub struct Metric {
 
 impl Metric {
     pub fn new(value: f64, noise: f64) -> Metric {
-        Metric {
-            value,
-            noise,
-        }
+        Metric { value, noise }
     }
 }
 
@@ -255,9 +252,7 @@ pub struct Options {
 
 impl Options {
     pub fn new() -> Options {
-        Options {
-            display_output: false,
-        }
+        Options { display_output: false }
     }
 
     pub fn display_output(mut self, display_output: bool) -> Options {
@@ -297,25 +292,24 @@ pub fn test_main(args: &[String], tests: Vec<TestDescAndFn>, options: Options) {
 // rather than a &[].
 pub fn test_main_static(tests: &[TestDescAndFn]) {
     let args = env::args().collect::<Vec<_>>();
-    let owned_tests = tests.iter()
-                           .map(|t| {
-                               match t.testfn {
-                                   StaticTestFn(f) => {
-                                       TestDescAndFn {
-                                           testfn: StaticTestFn(f),
-                                           desc: t.desc.clone(),
-                                       }
-                                   }
-                                   StaticBenchFn(f) => {
-                                       TestDescAndFn {
-                                           testfn: StaticBenchFn(f),
-                                           desc: t.desc.clone(),
-                                       }
-                                   }
-                                   _ => panic!("non-static tests passed to test::test_main_static"),
-                               }
-                           })
-                           .collect();
+    let owned_tests = tests
+        .iter()
+        .map(|t| match t.testfn {
+            StaticTestFn(f) => {
+                TestDescAndFn {
+                    testfn: StaticTestFn(f),
+                    desc: t.desc.clone(),
+                }
+            }
+            StaticBenchFn(f) => {
+                TestDescAndFn {
+                    testfn: StaticBenchFn(f),
+                    desc: t.desc.clone(),
+                }
+            }
+            _ => panic!("non-static tests passed to test::test_main_static"),
+        })
+        .collect();
     test_main(&args, owned_tests, Options::new())
 }
 
@@ -330,7 +324,7 @@ pub enum ColorConfig {
 pub enum OutputFormat {
     Pretty,
     Terse,
-    Json
+    Json,
 }
 
 #[derive(Debug)]
@@ -381,33 +375,76 @@ fn optgroups() -> getopts::Options {
         .optflag("", "bench", "Run benchmarks instead of tests")
         .optflag("", "list", "List all tests and benchmarks")
         .optflag("h", "help", "Display this message (longer with --help)")
-        .optopt("", "logfile", "Write logs to the specified file instead \
-                                of stdout", "PATH")
-        .optflag("", "nocapture", "don't capture stdout/stderr of each \
-                                   task, allow printing directly")
-        .optopt("", "test-threads", "Number of threads used for running tests \
-                                     in parallel", "n_threads")
-        .optmulti("", "skip", "Skip tests whose names contain FILTER (this flag can \
-                               be used multiple times)","FILTER")
-        .optflag("q", "quiet", "Display one character per test instead of one line. \
-                                Alias to --format=terse")
-        .optflag("", "exact", "Exactly match filters rather than by substring")
-        .optopt("", "color", "Configure coloring of output:
+        .optopt(
+            "",
+            "logfile",
+            "Write logs to the specified file instead \
+                                of stdout",
+            "PATH",
+        )
+        .optflag(
+            "",
+            "nocapture",
+            "don't capture stdout/stderr of each \
+                                   task, allow printing directly",
+        )
+        .optopt(
+            "",
+            "test-threads",
+            "Number of threads used for running tests \
+                                     in parallel",
+            "n_threads",
+        )
+        .optmulti(
+            "",
+            "skip",
+            "Skip tests whose names contain FILTER (this flag can \
+                               be used multiple times)",
+            "FILTER",
+        )
+        .optflag(
+            "q",
+            "quiet",
+            "Display one character per test instead of one line. \
+                                Alias to --format=terse",
+        )
+        .optflag(
+            "",
+            "exact",
+            "Exactly match filters rather than by substring",
+        )
+        .optopt(
+            "",
+            "color",
+            "Configure coloring of output:
             auto   = colorize if stdout is a tty and tests are run on serially (default);
             always = always colorize output;
-            never  = never colorize output;", "auto|always|never")
-        .optopt("", "format", "Configure formatting of output:
+            never  = never colorize output;",
+            "auto|always|never",
+        )
+        .optopt(
+            "",
+            "format",
+            "Configure formatting of output:
             pretty = Print verbose output;
             terse  = Display one character per test;
-            json   = Output a json document", "pretty|terse|json")
-        .optopt("Z", "", "Enable nightly-only flags:
-            unstable-options = Allow use of experimental features", "unstable-options");
-    return opts
+            json   = Output a json document",
+            "pretty|terse|json",
+        )
+        .optopt(
+            "Z",
+            "",
+            "Enable nightly-only flags:
+            unstable-options = Allow use of experimental features",
+            "unstable-options",
+        );
+    return opts;
 }
 
 fn usage(binary: &str, options: &getopts::Options) {
     let message = format!("Usage: {} [OPTIONS] [FILTER]", binary);
-    println!(r#"{usage}
+    println!(
+        r#"{usage}
 
 The FILTER string is tested against the name of all tests, and only those
 tests whose names contain the filter are run.
@@ -434,7 +471,8 @@ Test Attributes:
                      test, then the test runner will ignore these tests during
                      normal test runs. Running with --ignored will run these
                      tests."#,
-             usage = options.usage(&message));
+        usage = options.usage(&message)
+    );
 }
 
 // FIXME: Copied from libsyntax until linkage errors are resolved.
@@ -459,7 +497,10 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
 
     if let Some(opt) = matches.opt_str("Z") {
         if !is_nightly() {
-            return Some(Err("the option `Z` is only accepted on the nightly compiler".into()));
+            return Some(Err(
+                "the option `Z` is only accepted on the nightly compiler"
+                    .into(),
+            ));
         }
 
         match &*opt {
@@ -498,22 +539,25 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
     if !nocapture {
         nocapture = match env::var("RUST_TEST_NOCAPTURE") {
             Ok(val) => &val != "0",
-            Err(_) => false
+            Err(_) => false,
         };
     }
 
     let test_threads = match matches.opt_str("test-threads") {
-        Some(n_str) =>
+        Some(n_str) => {
             match n_str.parse::<usize>() {
-                Ok(0) =>
-                    return Some(Err(format!("argument for --test-threads must not be 0"))),
+                Ok(0) => return Some(Err(format!("argument for --test-threads must not be 0"))),
                 Ok(n) => Some(n),
-                Err(e) =>
-                    return Some(Err(format!("argument for --test-threads must be a number > 0 \
-                                             (error: {})", e)))
-            },
-        None =>
-            None,
+                Err(e) => {
+                    return Some(Err(format!(
+                        "argument for --test-threads must be a number > 0 \
+                                             (error: {})",
+                        e
+                    )))
+                }
+            }
+        }
+        None => None,
     };
 
     let color = match matches.opt_str("color").as_ref().map(|s| &**s) {
@@ -522,9 +566,11 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
         Some("never") => NeverColor,
 
         Some(v) => {
-            return Some(Err(format!("argument for --color must be auto, always, or never (was \
+            return Some(Err(format!(
+                "argument for --color must be auto, always, or never (was \
                                      {})",
-                                    v)))
+                v
+            )))
         }
     };
 
@@ -534,16 +580,20 @@ pub fn parse_opts(args: &[String]) -> Option<OptRes> {
         Some("terse") => OutputFormat::Terse,
         Some("json") => {
             if !allow_unstable {
-                return Some(
-                    Err("The \"json\" format is only accepted on the nightly compiler".into()));
+                return Some(Err(
+                    "The \"json\" format is only accepted on the nightly compiler"
+                        .into(),
+                ));
             }
             OutputFormat::Json
-        },
+        }
 
         Some(v) => {
-            return Some(Err(format!("argument for --format must be pretty, terse, or json (was \
+            return Some(Err(format!(
+                "argument for --format must be pretty, terse, or json (was \
                                      {})",
-                                    v)))
+                v
+            )))
         }
     };
 
@@ -593,14 +643,14 @@ impl<T: Write> Write for OutputLocation<T> {
     fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         match *self {
             Pretty(ref mut term) => term.write(buf),
-            Raw(ref mut stdout) => stdout.write(buf)
+            Raw(ref mut stdout) => stdout.write(buf),
         }
     }
 
     fn flush(&mut self) -> io::Result<()> {
         match *self {
             Pretty(ref mut term) => term.flush(),
-            Raw(ref mut stdout) => stdout.flush()
+            Raw(ref mut stdout) => stdout.flush(),
         }
     }
 }
@@ -652,17 +702,18 @@ impl ConsoleTestState {
     }
 
     pub fn write_log_result(&mut self, test: &TestDesc, result: &TestResult) -> io::Result<()> {
-        self.write_log(
-            format!("{} {}\n",
-                    match *result {
-                        TrOk => "ok".to_owned(),
-                        TrFailed => "failed".to_owned(),
-                        TrFailedMsg(ref msg) => format!("failed: {}", msg),
-                        TrIgnored => "ignored".to_owned(),
-                        TrAllowedFail => "failed (allowed)".to_owned(),
-                        TrBench(ref bs) => fmt_bench_samples(bs),
-                    },
-                    test.name))
+        self.write_log(format!(
+            "{} {}\n",
+            match *result {
+                TrOk => "ok".to_owned(),
+                TrFailed => "failed".to_owned(),
+                TrFailedMsg(ref msg) => format!("failed: {}", msg),
+                TrIgnored => "ignored".to_owned(),
+                TrAllowedFail => "failed (allowed)".to_owned(),
+                TrBench(ref bs) => fmt_bench_samples(bs),
+            },
+            test.name
+        ))
     }
 
     fn current_test_count(&self) -> usize {
@@ -701,12 +752,17 @@ pub fn fmt_bench_samples(bs: &BenchSamples) -> String {
     let median = bs.ns_iter_summ.median as usize;
     let deviation = (bs.ns_iter_summ.max - bs.ns_iter_summ.min) as usize;
 
-    output.write_fmt(format_args!("{:>11} ns/iter (+/- {})",
-                                  fmt_thousands_sep(median, ','),
-                                  fmt_thousands_sep(deviation, ',')))
-          .unwrap();
+    output
+        .write_fmt(format_args!(
+            "{:>11} ns/iter (+/- {})",
+            fmt_thousands_sep(median, ','),
+            fmt_thousands_sep(deviation, ',')
+        ))
+        .unwrap();
     if bs.mb_s != 0 {
-        output.write_fmt(format_args!(" = {} MB/s", bs.mb_s)).unwrap();
+        output
+            .write_fmt(format_args!(" = {} MB/s", bs.mb_s))
+            .unwrap();
     }
     output
 }
@@ -728,11 +784,21 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Res
     for test in filter_tests(&opts, tests) {
         use TestFn::*;
 
-        let TestDescAndFn { desc: TestDesc { name, .. }, testfn } = test;
+        let TestDescAndFn {
+            desc: TestDesc { name, .. },
+            testfn,
+        } = test;
 
         let fntype = match testfn {
-            StaticTestFn(..) | DynTestFn(..) => { ntest += 1; "test" },
-            StaticBenchFn(..) | DynBenchFn(..) => { nbench += 1; "benchmark" },
+            StaticTestFn(..) | DynTestFn(..) => {
+                ntest += 1;
+                "test"
+            }
+            StaticBenchFn(..) |
+            DynBenchFn(..) => {
+                nbench += 1;
+                "benchmark"
+            }
         };
 
         out.write_plain(format!("{}: {}\n", name, fntype))?;
@@ -750,9 +816,11 @@ pub fn list_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Res
         if ntest != 0 || nbench != 0 {
             out.write_plain("\n")?;
         }
-        out.write_plain(format!("{}, {}\n",
+        out.write_plain(format!(
+            "{}, {}\n",
             plural(ntest, "test"),
-            plural(nbench, "benchmark")))?;
+            plural(nbench, "benchmark")
+        ))?;
     }
 
     Ok(())
@@ -769,15 +837,17 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
         tests
     };
 
-    fn callback(event: &TestEvent,
-                st: &mut ConsoleTestState,
-                out: &mut OutputFormatter) -> io::Result<()> {
+    fn callback(
+        event: &TestEvent,
+        st: &mut ConsoleTestState,
+        out: &mut OutputFormatter,
+    ) -> io::Result<()> {
 
         match (*event).clone() {
             TeFiltered(ref filtered_tests) => {
                 st.total = filtered_tests.len();
                 out.write_run_start(filtered_tests.len())
-            },
+            }
             TeFilteredOut(filtered_out) => Ok(st.filtered_out = filtered_out),
             TeWait(ref test) => out.write_test_start(test),
             TeTimeout(ref test) => out.write_timeout(test),
@@ -792,9 +862,11 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
                     TrIgnored => st.ignored += 1,
                     TrAllowedFail => st.allowed_fail += 1,
                     TrBench(bs) => {
-                        st.metrics.insert_metric(test.name.as_slice(),
-                                                 bs.ns_iter_summ.median,
-                                                 bs.ns_iter_summ.max - bs.ns_iter_summ.min);
+                        st.metrics.insert_metric(
+                            test.name.as_slice(),
+                            bs.ns_iter_summ.median,
+                            bs.ns_iter_summ.max - bs.ns_iter_summ.min,
+                        );
                         st.measured += 1
                     }
                     TrFailed => {
@@ -804,9 +876,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
                     TrFailedMsg(msg) => {
                         st.failed += 1;
                         let mut stdout = stdout;
-                        stdout.extend_from_slice(
-                            format!("note: {}", msg).as_bytes()
-                        );
+                        stdout.extend_from_slice(format!("note: {}", msg).as_bytes());
                         st.failures.push((test, stdout));
                     }
                 }
@@ -820,10 +890,11 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
         Some(t) => Pretty(t),
     };
 
-    let max_name_len = tests.iter()
-                        .max_by_key(|t| len_if_padded(*t))
-                        .map(|t| t.desc.name.as_slice().len())
-                        .unwrap_or(0);
+    let max_name_len = tests
+        .iter()
+        .max_by_key(|t| len_if_padded(*t))
+        .map(|t| t.desc.name.as_slice().len())
+        .unwrap_or(0);
 
     let is_multithreaded = match opts.test_threads {
         Some(n) => n > 1,
@@ -831,16 +902,20 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
     };
 
     let mut out: Box<OutputFormatter> = match opts.format {
-        OutputFormat::Pretty => Box::new(HumanFormatter::new(output,
-                                                                use_color(opts),
-                                                                false,
-                                                                max_name_len,
-                                                                is_multithreaded)),
-        OutputFormat::Terse => Box::new(HumanFormatter::new(output,
-                                                                use_color(opts),
-                                                                true,
-                                                                max_name_len,
-                                                                is_multithreaded)),
+        OutputFormat::Pretty => Box::new(HumanFormatter::new(
+            output,
+            use_color(opts),
+            false,
+            max_name_len,
+            is_multithreaded,
+        )),
+        OutputFormat::Terse => Box::new(HumanFormatter::new(
+            output,
+            use_color(opts),
+            true,
+            max_name_len,
+            is_multithreaded,
+        )),
         OutputFormat::Json => Box::new(JsonFormatter::new(output)),
     };
     let mut st = ConsoleTestState::new(opts)?;
@@ -874,7 +949,7 @@ fn should_sort_failures_before_printing_them() {
         allow_fail: false,
     };
 
-    let mut out = HumanFormatter::new(Raw(Vec::new()), false, false, 10);
+    let mut out = HumanFormatter::new(Raw(Vec::new()), false, false, 10, false);
 
     let st = ConsoleTestState {
         log_out: None,
@@ -952,7 +1027,8 @@ pub type MonitorMsg = (TestDesc, TestResult, Vec<u8>);
 
 
 pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F) -> io::Result<()>
-    where F: FnMut(TestEvent) -> io::Result<()>
+where
+    F: FnMut(TestEvent) -> io::Result<()>,
 {
     use std::collections::HashMap;
     use std::sync::mpsc::RecvTimeoutError;
@@ -967,18 +1043,14 @@ pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F)
     let filtered_out = tests_len - filtered_tests.len();
     callback(TeFilteredOut(filtered_out))?;
 
-    let filtered_descs = filtered_tests.iter()
-                                       .map(|t| t.desc.clone())
-                                       .collect();
+    let filtered_descs = filtered_tests.iter().map(|t| t.desc.clone()).collect();
 
     callback(TeFiltered(filtered_descs))?;
 
     let (filtered_tests, filtered_benchs): (Vec<_>, _) =
-        filtered_tests.into_iter().partition(|e| {
-            match e.testfn {
-                StaticTestFn(_) | DynTestFn(_) => true,
-                _ => false,
-            }
+        filtered_tests.into_iter().partition(|e| match e.testfn {
+            StaticTestFn(_) | DynTestFn(_) => true,
+            _ => false,
         });
 
     let concurrency = match opts.test_threads {
@@ -996,8 +1068,13 @@ pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F)
 
     fn get_timed_out_tests(running_tests: &mut HashMap<TestDesc, Instant>) -> Vec<TestDesc> {
         let now = Instant::now();
-        let timed_out = running_tests.iter()
-            .filter_map(|(desc, timeout)| if &now >= timeout { Some(desc.clone())} else { None })
+        let timed_out = running_tests
+            .iter()
+            .filter_map(|(desc, timeout)| if &now >= timeout {
+                Some(desc.clone())
+            } else {
+                None
+            })
             .collect();
         for test in &timed_out {
             running_tests.remove(test);
@@ -1012,7 +1089,8 @@ pub fn run_tests<F>(opts: &TestOpts, tests: Vec<TestDescAndFn>, mut callback: F)
                 *next_timeout - now
             } else {
                 Duration::new(0, 0)
-            }})
+            }
+        })
     };
 
     if concurrency == 1 {
@@ -1078,8 +1156,10 @@ fn get_concurrency() -> usize {
             match opt_n {
                 Some(n) if n > 0 => n,
                 _ => {
-                    panic!("RUST_TEST_THREADS is `{}`, should be a positive integer.",
-                           s)
+                    panic!(
+                        "RUST_TEST_THREADS is `{}`, should be a positive integer.",
+                        s
+                    )
                 }
             }
         }
@@ -1136,10 +1216,8 @@ fn get_concurrency() -> usize {
         unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) as usize }
     }
 
-    #[cfg(any(target_os = "freebsd",
-              target_os = "dragonfly",
-              target_os = "bitrig",
-              target_os = "netbsd"))]
+    #[cfg(any(target_os = "freebsd", target_os = "dragonfly", target_os = "bitrig",
+                target_os = "netbsd"))]
     fn num_cpus() -> usize {
         use std::ptr;
 
@@ -1152,12 +1230,14 @@ fn get_concurrency() -> usize {
         if cpus < 1 {
             let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
             unsafe {
-                libc::sysctl(mib.as_mut_ptr(),
-                             2,
-                             &mut cpus as *mut _ as *mut _,
-                             &mut cpus_size as *mut _ as *mut _,
-                             ptr::null_mut(),
-                             0);
+                libc::sysctl(
+                    mib.as_mut_ptr(),
+                    2,
+                    &mut cpus as *mut _ as *mut _,
+                    &mut cpus_size as *mut _ as *mut _,
+                    ptr::null_mut(),
+                    0,
+                );
             }
             if cpus < 1 {
                 cpus = 1;
@@ -1175,12 +1255,14 @@ fn get_concurrency() -> usize {
         let mut mib = [libc::CTL_HW, libc::HW_NCPU, 0, 0];
 
         unsafe {
-            libc::sysctl(mib.as_mut_ptr(),
-                         2,
-                         &mut cpus as *mut _ as *mut _,
-                         &mut cpus_size as *mut _ as *mut _,
-                         ptr::null_mut(),
-                         0);
+            libc::sysctl(
+                mib.as_mut_ptr(),
+                2,
+                &mut cpus as *mut _ as *mut _,
+                &mut cpus_size as *mut _ as *mut _,
+                ptr::null_mut(),
+                0,
+            );
         }
         if cpus < 1 {
             cpus = 1;
@@ -1202,27 +1284,27 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
     filtered = match opts.filter {
         None => filtered,
         Some(ref filter) => {
-            filtered.into_iter()
-                    .filter(|test| {
-                        if opts.filter_exact {
-                            test.desc.name.as_slice() == &filter[..]
-                        } else {
-                            test.desc.name.as_slice().contains(&filter[..])
-                        }
-                    })
-                    .collect()
+            filtered
+                .into_iter()
+                .filter(|test| if opts.filter_exact {
+                    test.desc.name.as_slice() == &filter[..]
+                } else {
+                    test.desc.name.as_slice().contains(&filter[..])
+                })
+                .collect()
         }
     };
 
     // Skip tests that match any of the skip filters
-    filtered = filtered.into_iter()
-        .filter(|t| !opts.skip.iter().any(|sf| {
-                if opts.filter_exact {
-                    t.desc.name.as_slice() == &sf[..]
-                } else {
-                    t.desc.name.as_slice().contains(&sf[..])
-                }
-            }))
+    filtered = filtered
+        .into_iter()
+        .filter(|t| {
+            !opts.skip.iter().any(|sf| if opts.filter_exact {
+                t.desc.name.as_slice() == &sf[..]
+            } else {
+                t.desc.name.as_slice().contains(&sf[..])
+            })
+        })
         .collect();
 
     // Maybe pull out the ignored test and unignore them
@@ -1231,9 +1313,12 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
     } else {
         fn filter(test: TestDescAndFn) -> Option<TestDescAndFn> {
             if test.desc.ignore {
-                let TestDescAndFn {desc, testfn} = test;
+                let TestDescAndFn { desc, testfn } = test;
                 Some(TestDescAndFn {
-                    desc: TestDesc { ignore: false, ..desc },
+                    desc: TestDesc {
+                        ignore: false,
+                        ..desc
+                    },
                     testfn,
                 })
             } else {
@@ -1244,7 +1329,9 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> Vec<TestDescA
     };
 
     // Sort the tests alphabetically
-    filtered.sort_by(|t1, t2| t1.desc.name.as_slice().cmp(t2.desc.name.as_slice()));
+    filtered.sort_by(|t1, t2| {
+        t1.desc.name.as_slice().cmp(t2.desc.name.as_slice())
+    });
 
     filtered
 }
@@ -1267,24 +1354,26 @@ pub fn convert_benchmarks_to_tests(tests: Vec<TestDescAndFn>) -> Vec<TestDescAnd
                     })
                 }))
             }
-            f => f,
-        };
-        TestDescAndFn {
-            desc: x.desc,
-            testfn,
-        }
-    }).collect()
+                f => f,
+            };
+            TestDescAndFn {
+                desc: x.desc,
+                testfn,
+            }
+        })
+        .collect()
 }
 
-pub fn run_test(opts: &TestOpts,
-                force_ignore: bool,
-                test: TestDescAndFn,
-                monitor_ch: Sender<MonitorMsg>) {
+pub fn run_test(
+    opts: &TestOpts,
+    force_ignore: bool,
+    test: TestDescAndFn,
+    monitor_ch: Sender<MonitorMsg>,
+) {
 
-    let TestDescAndFn {desc, testfn} = test;
+    let TestDescAndFn { desc, testfn } = test;
 
-    let ignore_because_panic_abort =
-        cfg!(target_arch = "wasm32") &&
+    let ignore_because_panic_abort = cfg!(target_arch = "wasm32") &&
         !cfg!(target_os = "emscripten") &&
         desc.should_panic != ShouldPanic::No;
 
@@ -1316,7 +1405,7 @@ pub fn run_test(opts: &TestOpts,
             let oldio = if !nocapture {
                 Some((
                     io::set_print(Some(Box::new(Sink(data2.clone())))),
-                    io::set_panic(Some(Box::new(Sink(data2))))
+                    io::set_panic(Some(Box::new(Sink(data2)))),
                 ))
             } else {
                 None
@@ -1331,16 +1420,16 @@ pub fn run_test(opts: &TestOpts,
 
             let test_result = calc_result(&desc, result);
             let stdout = data.lock().unwrap().to_vec();
-            monitor_ch.send((desc.clone(), test_result, stdout)).unwrap();
+            monitor_ch
+                .send((desc.clone(), test_result, stdout))
+                .unwrap();
         };
 
 
         // If the platform is single-threaded we're just going to run
         // the test synchronously, regardless of the concurrency
         // level.
-        let supports_threads =
-            !cfg!(target_os = "emscripten") &&
-            !cfg!(target_arch = "wasm32");
+        let supports_threads = !cfg!(target_os = "emscripten") && !cfg!(target_arch = "wasm32");
         if supports_threads {
             let cfg = thread::Builder::new().name(name.as_slice().to_owned());
             cfg.spawn(runtest).unwrap();
@@ -1382,12 +1471,13 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box<Any + Send>>) -> Tes
     match (&desc.should_panic, task_result) {
         (&ShouldPanic::No, Ok(())) |
         (&ShouldPanic::Yes, Err(_)) => TrOk,
-        (&ShouldPanic::YesWithMessage(msg), Err(ref err)) =>
+        (&ShouldPanic::YesWithMessage(msg), Err(ref err)) => {
             if err.downcast_ref::<String>()
-                  .map(|e| &**e)
-                  .or_else(|| err.downcast_ref::<&'static str>().map(|e| *e))
-                  .map(|e| e.contains(msg))
-                  .unwrap_or(false) {
+                .map(|e| &**e)
+                .or_else(|| err.downcast_ref::<&'static str>().map(|e| *e))
+                .map(|e| e.contains(msg))
+                .unwrap_or(false)
+            {
                 TrOk
             } else {
                 if desc.allow_fail {
@@ -1395,7 +1485,8 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box<Any + Send>>) -> Tes
                 } else {
                     TrFailedMsg(format!("Panic did not include expected string '{}'", msg))
                 }
-            },
+            }
+        }
         _ if desc.allow_fail => TrAllowedFail,
         _ => TrFailed,
     }
@@ -1423,18 +1514,15 @@ impl MetricMap {
     /// you want to see grow larger, so a change larger than `noise` in the
     /// negative direction represents a regression.
     pub fn insert_metric(&mut self, name: &str, value: f64, noise: f64) {
-        let m = Metric {
-            value,
-            noise,
-        };
+        let m = Metric { value, noise };
         self.0.insert(name.to_owned(), m);
     }
 
     pub fn fmt_metrics(&self) -> String {
         let v = self.0
-                   .iter()
-                   .map(|(k, v)| format!("{}: {} (+/- {})", *k, v.value, v.noise))
-                   .collect::<Vec<_>>();
+            .iter()
+            .map(|(k, v)| format!("{}: {} (+/- {})", *k, v.value, v.noise))
+            .collect::<Vec<_>>();
         v.join(", ")
     }
 }
@@ -1464,7 +1552,8 @@ pub fn black_box<T>(dummy: T) -> T {
 impl Bencher {
     /// Callback for benchmark functions to run in their body.
     pub fn iter<T, F>(&mut self, mut inner: F)
-        where F: FnMut() -> T
+    where
+        F: FnMut() -> T,
     {
         if self.mode == BenchMode::Single {
             ns_iter_inner(&mut inner, 1);
@@ -1475,7 +1564,8 @@ impl Bencher {
     }
 
     pub fn bench<F>(&mut self, mut f: F) -> Option<stats::Summary>
-        where F: FnMut(&mut Bencher)
+    where
+        F: FnMut(&mut Bencher),
     {
         f(self);
         return self.summary;
@@ -1487,7 +1577,8 @@ fn ns_from_dur(dur: Duration) -> u64 {
 }
 
 fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64
-    where F: FnMut() -> T
+where
+    F: FnMut() -> T,
 {
     let start = Instant::now();
     for _ in 0..k {
@@ -1498,7 +1589,8 @@ fn ns_iter_inner<T, F>(inner: &mut F, k: u64) -> u64
 
 
 pub fn iter<T, F>(inner: &mut F) -> stats::Summary
-    where F: FnMut() -> T
+where
+    F: FnMut() -> T,
 {
     // Initial bench run to get ballpark figure.
     let ns_single = ns_iter_inner(inner, 1);
@@ -1540,7 +1632,8 @@ pub fn iter<T, F>(inner: &mut F) -> stats::Summary
         // If we've run for 100ms and seem to have converged to a
         // stable median.
         if loop_run > Duration::from_millis(100) && summ.median_abs_dev_pct < 1.0 &&
-           summ.median - summ5.median < summ5.median_abs_dev {
+            summ.median - summ5.median < summ5.median_abs_dev
+        {
             return summ5;
         }
 
@@ -1569,7 +1662,8 @@ pub mod bench {
     use super::{Bencher, BenchSamples, BenchMode};
 
     pub fn benchmark<F>(f: F) -> BenchSamples
-        where F: FnMut(&mut Bencher)
+    where
+        F: FnMut(&mut Bencher),
     {
         let mut bs = Bencher {
             mode: BenchMode::Auto,
@@ -1600,7 +1694,8 @@ pub mod bench {
     }
 
     pub fn run_once<F>(f: F)
-        where F: FnMut(&mut Bencher)
+    where
+        F: FnMut(&mut Bencher),
     {
         let mut bs = Bencher {
             mode: BenchMode::Single,
@@ -1740,7 +1835,11 @@ mod tests {
 
     #[test]
     fn parse_ignored_flag() {
-        let args = vec!["progname".to_string(), "filter".to_string(), "--ignored".to_string()];
+        let args = vec![
+            "progname".to_string(),
+            "filter".to_string(),
+            "--ignored".to_string(),
+        ];
         let opts = match parse_opts(&args) {
             Some(Ok(o)) => o,
             _ => panic!("Malformed arg in parse_ignored_flag"),
@@ -1757,7 +1856,8 @@ mod tests {
         opts.run_tests = true;
         opts.run_ignored = true;
 
-        let tests = vec![TestDescAndFn {
+        let tests =
+            vec![TestDescAndFn {
                              desc: TestDesc {
                                  name: StaticTestName("1"),
                                  ignore: true,
@@ -1785,72 +1885,95 @@ mod tests {
     #[test]
     pub fn exact_filter_match() {
         fn tests() -> Vec<TestDescAndFn> {
-            vec!["base",
-                 "base::test",
-                 "base::test1",
-                 "base::test2",
-            ].into_iter()
-            .map(|name| TestDescAndFn {
-                desc: TestDesc {
-                    name: StaticTestName(name),
-                    ignore: false,
-                    should_panic: ShouldPanic::No,
-                    allow_fail: false,
-                },
-                testfn: DynTestFn(Box::new(move || {}))
-            })
-            .collect()
+            vec!["base", "base::test", "base::test1", "base::test2"]
+                .into_iter()
+                .map(|name| {
+                    TestDescAndFn {
+                        desc: TestDesc {
+                            name: StaticTestName(name),
+                            ignore: false,
+                            should_panic: ShouldPanic::No,
+                            allow_fail: false,
+                        },
+                        testfn: DynTestFn(Box::new(move || {}))
+                    }
+                }).collect()
         }
 
-        let substr = filter_tests(&TestOpts {
+        let substr = filter_tests(
+            &TestOpts {
                 filter: Some("base".into()),
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(substr.len(), 4);
 
-        let substr = filter_tests(&TestOpts {
+        let substr = filter_tests(
+            &TestOpts {
                 filter: Some("bas".into()),
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(substr.len(), 4);
 
-        let substr = filter_tests(&TestOpts {
+        let substr = filter_tests(
+            &TestOpts {
                 filter: Some("::test".into()),
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(substr.len(), 3);
 
-        let substr = filter_tests(&TestOpts {
+        let substr = filter_tests(
+            &TestOpts {
                 filter: Some("base::test".into()),
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(substr.len(), 3);
 
-        let exact = filter_tests(&TestOpts {
+        let exact = filter_tests(
+            &TestOpts {
                 filter: Some("base".into()),
-                filter_exact: true, ..TestOpts::new()
-            }, tests());
+                filter_exact: true,
+                ..TestOpts::new()
+            },
+            tests(),
+        );
         assert_eq!(exact.len(), 1);
 
-        let exact = filter_tests(&TestOpts {
+        let exact = filter_tests(
+            &TestOpts {
                 filter: Some("bas".into()),
                 filter_exact: true,
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(exact.len(), 0);
 
-        let exact = filter_tests(&TestOpts {
+        let exact = filter_tests(
+            &TestOpts {
                 filter: Some("::test".into()),
                 filter_exact: true,
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(exact.len(), 0);
 
-        let exact = filter_tests(&TestOpts {
+        let exact = filter_tests(
+            &TestOpts {
                 filter: Some("base::test".into()),
                 filter_exact: true,
                 ..TestOpts::new()
-            }, tests());
+            },
+            tests(),
+        );
         assert_eq!(exact.len(), 1);
     }
 
@@ -1859,15 +1982,17 @@ mod tests {
         let mut opts = TestOpts::new();
         opts.run_tests = true;
 
-        let names = vec!["sha1::test".to_string(),
-                         "isize::test_to_str".to_string(),
-                         "isize::test_pow".to_string(),
-                         "test::do_not_run_ignored_tests".to_string(),
-                         "test::ignored_tests_result_in_ignored".to_string(),
-                         "test::first_free_arg_should_be_a_filter".to_string(),
-                         "test::parse_ignored_flag".to_string(),
-                         "test::filter_for_ignored_option".to_string(),
-                         "test::sort_tests".to_string()];
+        let names = vec![
+            "sha1::test".to_string(),
+            "isize::test_to_str".to_string(),
+            "isize::test_pow".to_string(),
+            "test::do_not_run_ignored_tests".to_string(),
+            "test::ignored_tests_result_in_ignored".to_string(),
+            "test::first_free_arg_should_be_a_filter".to_string(),
+            "test::parse_ignored_flag".to_string(),
+            "test::filter_for_ignored_option".to_string(),
+            "test::sort_tests".to_string(),
+        ];
         let tests = {
             fn testfn() {}
             let mut tests = Vec::new();
@@ -1887,15 +2012,17 @@ mod tests {
         };
         let filtered = filter_tests(&opts, tests);
 
-        let expected = vec!["isize::test_pow".to_string(),
-                            "isize::test_to_str".to_string(),
-                            "sha1::test".to_string(),
-                            "test::do_not_run_ignored_tests".to_string(),
-                            "test::filter_for_ignored_option".to_string(),
-                            "test::first_free_arg_should_be_a_filter".to_string(),
-                            "test::ignored_tests_result_in_ignored".to_string(),
-                            "test::parse_ignored_flag".to_string(),
-                            "test::sort_tests".to_string()];
+        let expected = vec![
+            "isize::test_pow".to_string(),
+            "isize::test_to_str".to_string(),
+            "sha1::test".to_string(),
+            "test::do_not_run_ignored_tests".to_string(),
+            "test::filter_for_ignored_option".to_string(),
+            "test::first_free_arg_should_be_a_filter".to_string(),
+            "test::ignored_tests_result_in_ignored".to_string(),
+            "test::parse_ignored_flag".to_string(),
+            "test::sort_tests".to_string(),
+        ];
 
         for (a, b) in expected.iter().zip(filtered) {
             assert!(*a == b.desc.name.to_string());
@@ -1934,8 +2061,7 @@ mod tests {
     #[test]
     pub fn test_bench_once_iter() {
         fn f(b: &mut Bencher) {
-            b.iter(|| {
-            })
+            b.iter(|| {})
         }
         bench::run_once(f);
     }
@@ -1949,8 +2075,7 @@ mod tests {
     #[test]
     pub fn test_bench_iter() {
         fn f(b: &mut Bencher) {
-            b.iter(|| {
-            })
+            b.iter(|| {})
         }
         bench::benchmark(f);
     }
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 9f8b4a73d0c..e22fdf77fc1 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -400,16 +400,18 @@ mod tests {
     }
     #[test]
     fn test_norm10narrow() {
-        let val = &[966.0000000000,
-                    985.0000000000,
-                    1110.0000000000,
-                    848.0000000000,
-                    821.0000000000,
-                    975.0000000000,
-                    962.0000000000,
-                    1157.0000000000,
-                    1217.0000000000,
-                    955.0000000000];
+        let val = &[
+            966.0000000000,
+            985.0000000000,
+            1110.0000000000,
+            848.0000000000,
+            821.0000000000,
+            975.0000000000,
+            962.0000000000,
+            1157.0000000000,
+            1217.0000000000,
+            955.0000000000,
+        ];
         let summ = &Summary {
             sum: 9996.0000000000,
             min: 821.0000000000,
@@ -428,16 +430,18 @@ mod tests {
     }
     #[test]
     fn test_norm10medium() {
-        let val = &[954.0000000000,
-                    1064.0000000000,
-                    855.0000000000,
-                    1000.0000000000,
-                    743.0000000000,
-                    1084.0000000000,
-                    704.0000000000,
-                    1023.0000000000,
-                    357.0000000000,
-                    869.0000000000];
+        let val = &[
+            954.0000000000,
+            1064.0000000000,
+            855.0000000000,
+            1000.0000000000,
+            743.0000000000,
+            1084.0000000000,
+            704.0000000000,
+            1023.0000000000,
+            357.0000000000,
+            869.0000000000,
+        ];
         let summ = &Summary {
             sum: 8653.0000000000,
             min: 357.0000000000,
@@ -456,16 +460,18 @@ mod tests {
     }
     #[test]
     fn test_norm10wide() {
-        let val = &[505.0000000000,
-                    497.0000000000,
-                    1591.0000000000,
-                    887.0000000000,
-                    1026.0000000000,
-                    136.0000000000,
-                    1580.0000000000,
-                    940.0000000000,
-                    754.0000000000,
-                    1433.0000000000];
+        let val = &[
+            505.0000000000,
+            497.0000000000,
+            1591.0000000000,
+            887.0000000000,
+            1026.0000000000,
+            136.0000000000,
+            1580.0000000000,
+            940.0000000000,
+            754.0000000000,
+            1433.0000000000,
+        ];
         let summ = &Summary {
             sum: 9349.0000000000,
             min: 136.0000000000,
@@ -484,31 +490,33 @@ mod tests {
     }
     #[test]
     fn test_norm25verynarrow() {
-        let val = &[991.0000000000,
-                    1018.0000000000,
-                    998.0000000000,
-                    1013.0000000000,
-                    974.0000000000,
-                    1007.0000000000,
-                    1014.0000000000,
-                    999.0000000000,
-                    1011.0000000000,
-                    978.0000000000,
-                    985.0000000000,
-                    999.0000000000,
-                    983.0000000000,
-                    982.0000000000,
-                    1015.0000000000,
-                    1002.0000000000,
-                    977.0000000000,
-                    948.0000000000,
-                    1040.0000000000,
-                    974.0000000000,
-                    996.0000000000,
-                    989.0000000000,
-                    1015.0000000000,
-                    994.0000000000,
-                    1024.0000000000];
+        let val = &[
+            991.0000000000,
+            1018.0000000000,
+            998.0000000000,
+            1013.0000000000,
+            974.0000000000,
+            1007.0000000000,
+            1014.0000000000,
+            999.0000000000,
+            1011.0000000000,
+            978.0000000000,
+            985.0000000000,
+            999.0000000000,
+            983.0000000000,
+            982.0000000000,
+            1015.0000000000,
+            1002.0000000000,
+            977.0000000000,
+            948.0000000000,
+            1040.0000000000,
+            974.0000000000,
+            996.0000000000,
+            989.0000000000,
+            1015.0000000000,
+            994.0000000000,
+            1024.0000000000,
+        ];
         let summ = &Summary {
             sum: 24926.0000000000,
             min: 948.0000000000,
@@ -527,16 +535,18 @@ mod tests {
     }
     #[test]
     fn test_exp10a() {
-        let val = &[23.0000000000,
-                    11.0000000000,
-                    2.0000000000,
-                    57.0000000000,
-                    4.0000000000,
-                    12.0000000000,
-                    5.0000000000,
-                    29.0000000000,
-                    3.0000000000,
-                    21.0000000000];
+        let val = &[
+            23.0000000000,
+            11.0000000000,
+            2.0000000000,
+            57.0000000000,
+            4.0000000000,
+            12.0000000000,
+            5.0000000000,
+            29.0000000000,
+            3.0000000000,
+            21.0000000000,
+        ];
         let summ = &Summary {
             sum: 167.0000000000,
             min: 2.0000000000,
@@ -555,16 +565,18 @@ mod tests {
     }
     #[test]
     fn test_exp10b() {
-        let val = &[24.0000000000,
-                    17.0000000000,
-                    6.0000000000,
-                    38.0000000000,
-                    25.0000000000,
-                    7.0000000000,
-                    51.0000000000,
-                    2.0000000000,
-                    61.0000000000,
-                    32.0000000000];
+        let val = &[
+            24.0000000000,
+            17.0000000000,
+            6.0000000000,
+            38.0000000000,
+            25.0000000000,
+            7.0000000000,
+            51.0000000000,
+            2.0000000000,
+            61.0000000000,
+            32.0000000000,
+        ];
         let summ = &Summary {
             sum: 263.0000000000,
             min: 2.0000000000,
@@ -583,16 +595,18 @@ mod tests {
     }
     #[test]
     fn test_exp10c() {
-        let val = &[71.0000000000,
-                    2.0000000000,
-                    32.0000000000,
-                    1.0000000000,
-                    6.0000000000,
-                    28.0000000000,
-                    13.0000000000,
-                    37.0000000000,
-                    16.0000000000,
-                    36.0000000000];
+        let val = &[
+            71.0000000000,
+            2.0000000000,
+            32.0000000000,
+            1.0000000000,
+            6.0000000000,
+            28.0000000000,
+            13.0000000000,
+            37.0000000000,
+            16.0000000000,
+            36.0000000000,
+        ];
         let summ = &Summary {
             sum: 242.0000000000,
             min: 1.0000000000,
@@ -611,31 +625,33 @@ mod tests {
     }
     #[test]
     fn test_exp25() {
-        let val = &[3.0000000000,
-                    24.0000000000,
-                    1.0000000000,
-                    19.0000000000,
-                    7.0000000000,
-                    5.0000000000,
-                    30.0000000000,
-                    39.0000000000,
-                    31.0000000000,
-                    13.0000000000,
-                    25.0000000000,
-                    48.0000000000,
-                    1.0000000000,
-                    6.0000000000,
-                    42.0000000000,
-                    63.0000000000,
-                    2.0000000000,
-                    12.0000000000,
-                    108.0000000000,
-                    26.0000000000,
-                    1.0000000000,
-                    7.0000000000,
-                    44.0000000000,
-                    25.0000000000,
-                    11.0000000000];
+        let val = &[
+            3.0000000000,
+            24.0000000000,
+            1.0000000000,
+            19.0000000000,
+            7.0000000000,
+            5.0000000000,
+            30.0000000000,
+            39.0000000000,
+            31.0000000000,
+            13.0000000000,
+            25.0000000000,
+            48.0000000000,
+            1.0000000000,
+            6.0000000000,
+            42.0000000000,
+            63.0000000000,
+            2.0000000000,
+            12.0000000000,
+            108.0000000000,
+            26.0000000000,
+            1.0000000000,
+            7.0000000000,
+            44.0000000000,
+            25.0000000000,
+            11.0000000000,
+        ];
         let summ = &Summary {
             sum: 593.0000000000,
             min: 1.0000000000,
@@ -654,31 +670,33 @@ mod tests {
     }
     #[test]
     fn test_binom25() {
-        let val = &[18.0000000000,
-                    17.0000000000,
-                    27.0000000000,
-                    15.0000000000,
-                    21.0000000000,
-                    25.0000000000,
-                    17.0000000000,
-                    24.0000000000,
-                    25.0000000000,
-                    24.0000000000,
-                    26.0000000000,
-                    26.0000000000,
-                    23.0000000000,
-                    15.0000000000,
-                    23.0000000000,
-                    17.0000000000,
-                    18.0000000000,
-                    18.0000000000,
-                    21.0000000000,
-                    16.0000000000,
-                    15.0000000000,
-                    31.0000000000,
-                    20.0000000000,
-                    17.0000000000,
-                    15.0000000000];
+        let val = &[
+            18.0000000000,
+            17.0000000000,
+            27.0000000000,
+            15.0000000000,
+            21.0000000000,
+            25.0000000000,
+            17.0000000000,
+            24.0000000000,
+            25.0000000000,
+            24.0000000000,
+            26.0000000000,
+            26.0000000000,
+            23.0000000000,
+            15.0000000000,
+            23.0000000000,
+            17.0000000000,
+            18.0000000000,
+            18.0000000000,
+            21.0000000000,
+            16.0000000000,
+            15.0000000000,
+            31.0000000000,
+            20.0000000000,
+            17.0000000000,
+            15.0000000000,
+        ];
         let summ = &Summary {
             sum: 514.0000000000,
             min: 15.0000000000,
@@ -697,31 +715,33 @@ mod tests {
     }
     #[test]
     fn test_pois25lambda30() {
-        let val = &[27.0000000000,
-                    33.0000000000,
-                    34.0000000000,
-                    34.0000000000,
-                    24.0000000000,
-                    39.0000000000,
-                    28.0000000000,
-                    27.0000000000,
-                    31.0000000000,
-                    28.0000000000,
-                    38.0000000000,
-                    21.0000000000,
-                    33.0000000000,
-                    36.0000000000,
-                    29.0000000000,
-                    37.0000000000,
-                    32.0000000000,
-                    34.0000000000,
-                    31.0000000000,
-                    39.0000000000,
-                    25.0000000000,
-                    31.0000000000,
-                    32.0000000000,
-                    40.0000000000,
-                    24.0000000000];
+        let val = &[
+            27.0000000000,
+            33.0000000000,
+            34.0000000000,
+            34.0000000000,
+            24.0000000000,
+            39.0000000000,
+            28.0000000000,
+            27.0000000000,
+            31.0000000000,
+            28.0000000000,
+            38.0000000000,
+            21.0000000000,
+            33.0000000000,
+            36.0000000000,
+            29.0000000000,
+            37.0000000000,
+            32.0000000000,
+            34.0000000000,
+            31.0000000000,
+            39.0000000000,
+            25.0000000000,
+            31.0000000000,
+            32.0000000000,
+            40.0000000000,
+            24.0000000000,
+        ];
         let summ = &Summary {
             sum: 787.0000000000,
             min: 21.0000000000,
@@ -740,31 +760,33 @@ mod tests {
     }
     #[test]
     fn test_pois25lambda40() {
-        let val = &[42.0000000000,
-                    50.0000000000,
-                    42.0000000000,
-                    46.0000000000,
-                    34.0000000000,
-                    45.0000000000,
-                    34.0000000000,
-                    49.0000000000,
-                    39.0000000000,
-                    28.0000000000,
-                    40.0000000000,
-                    35.0000000000,
-                    37.0000000000,
-                    39.0000000000,
-                    46.0000000000,
-                    44.0000000000,
-                    32.0000000000,
-                    45.0000000000,
-                    42.0000000000,
-                    37.0000000000,
-                    48.0000000000,
-                    42.0000000000,
-                    33.0000000000,
-                    42.0000000000,
-                    48.0000000000];
+        let val = &[
+            42.0000000000,
+            50.0000000000,
+            42.0000000000,
+            46.0000000000,
+            34.0000000000,
+            45.0000000000,
+            34.0000000000,
+            49.0000000000,
+            39.0000000000,
+            28.0000000000,
+            40.0000000000,
+            35.0000000000,
+            37.0000000000,
+            39.0000000000,
+            46.0000000000,
+            44.0000000000,
+            32.0000000000,
+            45.0000000000,
+            42.0000000000,
+            37.0000000000,
+            48.0000000000,
+            42.0000000000,
+            33.0000000000,
+            42.0000000000,
+            48.0000000000,
+        ];
         let summ = &Summary {
             sum: 1019.0000000000,
             min: 28.0000000000,
@@ -783,31 +805,33 @@ mod tests {
     }
     #[test]
     fn test_pois25lambda50() {
-        let val = &[45.0000000000,
-                    43.0000000000,
-                    44.0000000000,
-                    61.0000000000,
-                    51.0000000000,
-                    53.0000000000,
-                    59.0000000000,
-                    52.0000000000,
-                    49.0000000000,
-                    51.0000000000,
-                    51.0000000000,
-                    50.0000000000,
-                    49.0000000000,
-                    56.0000000000,
-                    42.0000000000,
-                    52.0000000000,
-                    51.0000000000,
-                    43.0000000000,
-                    48.0000000000,
-                    48.0000000000,
-                    50.0000000000,
-                    42.0000000000,
-                    43.0000000000,
-                    42.0000000000,
-                    60.0000000000];
+        let val = &[
+            45.0000000000,
+            43.0000000000,
+            44.0000000000,
+            61.0000000000,
+            51.0000000000,
+            53.0000000000,
+            59.0000000000,
+            52.0000000000,
+            49.0000000000,
+            51.0000000000,
+            51.0000000000,
+            50.0000000000,
+            49.0000000000,
+            56.0000000000,
+            42.0000000000,
+            52.0000000000,
+            51.0000000000,
+            43.0000000000,
+            48.0000000000,
+            48.0000000000,
+            50.0000000000,
+            42.0000000000,
+            43.0000000000,
+            42.0000000000,
+            60.0000000000,
+        ];
         let summ = &Summary {
             sum: 1235.0000000000,
             min: 42.0000000000,
@@ -826,31 +850,33 @@ mod tests {
     }
     #[test]
     fn test_unif25() {
-        let val = &[99.0000000000,
-                    55.0000000000,
-                    92.0000000000,
-                    79.0000000000,
-                    14.0000000000,
-                    2.0000000000,
-                    33.0000000000,
-                    49.0000000000,
-                    3.0000000000,
-                    32.0000000000,
-                    84.0000000000,
-                    59.0000000000,
-                    22.0000000000,
-                    86.0000000000,
-                    76.0000000000,
-                    31.0000000000,
-                    29.0000000000,
-                    11.0000000000,
-                    41.0000000000,
-                    53.0000000000,
-                    45.0000000000,
-                    44.0000000000,
-                    98.0000000000,
-                    98.0000000000,
-                    7.0000000000];
+        let val = &[
+            99.0000000000,
+            55.0000000000,
+            92.0000000000,
+            79.0000000000,
+            14.0000000000,
+            2.0000000000,
+            33.0000000000,
+            49.0000000000,
+            3.0000000000,
+            32.0000000000,
+            84.0000000000,
+            59.0000000000,
+            22.0000000000,
+            86.0000000000,
+            76.0000000000,
+            31.0000000000,
+            29.0000000000,
+            11.0000000000,
+            41.0000000000,
+            53.0000000000,
+            45.0000000000,
+            44.0000000000,
+            98.0000000000,
+            98.0000000000,
+            7.0000000000,
+        ];
         let summ = &Summary {
             sum: 1242.0000000000,
             min: 2.0000000000,
@@ -885,18 +911,14 @@ mod bench {
 
     #[bench]
     pub fn sum_three_items(b: &mut Bencher) {
-        b.iter(|| {
-            [1e20f64, 1.5f64, -1e20f64].sum();
-        })
+        b.iter(|| { [1e20f64, 1.5f64, -1e20f64].sum(); })
     }
     #[bench]
     pub fn sum_many_f64(b: &mut Bencher) {
         let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60];
         let v = (0..500).map(|i| nums[i % 5]).collect::<Vec<_>>();
 
-        b.iter(|| {
-            v.sum();
-        })
+        b.iter(|| { v.sum(); })
     }
 
     #[bench]