diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-02 08:25:24 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-02 08:25:24 +0900 |
| commit | fbb3dd47804a799beaed183ac296b71e482ec018 (patch) | |
| tree | cc65688d238631daf02b502107a51c829f17cc74 | |
| parent | 2e749ab5a49290a9414cfcd7fd37be1b012e596a (diff) | |
| parent | 8164218181d8fc22a7247a686ec9af9d61f70d44 (diff) | |
| download | rust-fbb3dd47804a799beaed183ac296b71e482ec018.tar.gz rust-fbb3dd47804a799beaed183ac296b71e482ec018.zip | |
Rollup merge of #77389 - jyn514:THE-PAPERCLIP-COMETH, r=Mark-Simulacrum
Fix some clippy lints Found while working on https://github.com/rust-lang/rust/pull/77351; these are just the ones that could be fixed automatically.
| -rw-r--r-- | library/test/src/bench.rs | 2 | ||||
| -rw-r--r-- | library/test/src/formatters/pretty.rs | 2 | ||||
| -rw-r--r-- | library/test/src/formatters/terse.rs | 4 | ||||
| -rw-r--r-- | library/test/src/lib.rs | 8 | ||||
| -rw-r--r-- | library/test/src/stats.rs | 2 |
5 files changed, 8 insertions, 10 deletions
diff --git a/library/test/src/bench.rs b/library/test/src/bench.rs index a03cf9dd791..10546de1764 100644 --- a/library/test/src/bench.rs +++ b/library/test/src/bench.rs @@ -159,7 +159,7 @@ where return summ5; } - total_run = total_run + loop_run; + total_run += loop_run; // Longest we ever run for is 3s. if total_run > Duration::from_secs(3) { return summ5; diff --git a/library/test/src/formatters/pretty.rs b/library/test/src/formatters/pretty.rs index 4a93e084df1..8c90b57b3ba 100644 --- a/library/test/src/formatters/pretty.rs +++ b/library/test/src/formatters/pretty.rs @@ -139,7 +139,7 @@ impl<T: Write> PrettyFormatter<T> { stdouts.push_str(&format!("---- {} stdout ----\n", f.name)); let output = String::from_utf8_lossy(stdout); stdouts.push_str(&output); - stdouts.push_str("\n"); + stdouts.push('\n'); } } if !stdouts.is_empty() { diff --git a/library/test/src/formatters/terse.rs b/library/test/src/formatters/terse.rs index 5a264d20057..1ae7846a99e 100644 --- a/library/test/src/formatters/terse.rs +++ b/library/test/src/formatters/terse.rs @@ -114,7 +114,7 @@ impl<T: Write> TerseFormatter<T> { stdouts.push_str(&format!("---- {} stdout ----\n", f.name)); let output = String::from_utf8_lossy(stdout); stdouts.push_str(&output); - stdouts.push_str("\n"); + stdouts.push('\n'); } } if !stdouts.is_empty() { @@ -140,7 +140,7 @@ impl<T: Write> TerseFormatter<T> { fail_out.push_str(&format!("---- {} stdout ----\n", f.name)); let output = String::from_utf8_lossy(stdout); fail_out.push_str(&output); - fail_out.push_str("\n"); + fail_out.push('\n'); } } if !fail_out.is_empty() { diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index caea4b1e309..b0b81f85fe0 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -237,11 +237,9 @@ where let event = TestEvent::TeFiltered(filtered_descs); notify_about_test_event(event)?; - let (filtered_tests, filtered_benchs): (Vec<_>, _) = - filtered_tests.into_iter().partition(|e| match e.testfn { - StaticTestFn(_) | DynTestFn(_) => true, - _ => false, - }); + let (filtered_tests, filtered_benchs): (Vec<_>, _) = filtered_tests + .into_iter() + .partition(|e| matches!(e.testfn, StaticTestFn(_) | DynTestFn(_))); let concurrency = opts.test_threads.unwrap_or_else(get_concurrency); diff --git a/library/test/src/stats.rs b/library/test/src/stats.rs index 1a2cb893a8a..53f38894474 100644 --- a/library/test/src/stats.rs +++ b/library/test/src/stats.rs @@ -199,7 +199,7 @@ impl Stats for [f64] { let mut v: f64 = 0.0; for s in self { let x = *s - mean; - v = v + x * x; + v += x * x; } // N.B., this is _supposed to be_ len-1, not len. If you // change it back to len, you will be calculating a |
