diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-02-02 04:40:57 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-02-02 04:40:57 -0500 |
| commit | 4197e5fe03477eebcaaffa784d272b3dbdeb881d (patch) | |
| tree | 480dfd9c1d7c2c4d1dbc45273fa6d57bb45cc898 /src | |
| parent | ca4b9674c26c1de07a2042cb68e6a062d7184cef (diff) | |
| download | rust-4197e5fe03477eebcaaffa784d272b3dbdeb881d.tar.gz rust-4197e5fe03477eebcaaffa784d272b3dbdeb881d.zip | |
Fix discrepencies in the testing chapter
Fixes #21501
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/trpl/testing.md | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/doc/trpl/testing.md b/src/doc/trpl/testing.md index 1c93fd351b6..9c46c8724d4 100644 --- a/src/doc/trpl/testing.md +++ b/src/doc/trpl/testing.md @@ -552,9 +552,7 @@ extern crate test; # struct X; # impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X; b.iter(|| { - let mut n = 1000_u32; - - test::black_box(&mut n); // pretend to modify `n` + let n = test::black_box(1000); range(0, n).fold(0, |a, b| a ^ b) }) @@ -569,7 +567,7 @@ Performing either of the above changes gives the following benchmarking results ```text running 1 test -test bench_xor_1000_ints ... bench: 1 ns/iter (+/- 0) +test bench_xor_1000_ints ... bench: 131 ns/iter (+/- 3) test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured ``` |
