We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca4b967 commit 4197e5fCopy full SHA for 4197e5f
src/doc/trpl/testing.md
@@ -552,9 +552,7 @@ extern crate test;
552
# struct X;
553
# impl X { fn iter<T, F>(&self, _: F) where F: FnMut() -> T {} } let b = X;
554
b.iter(|| {
555
- let mut n = 1000_u32;
556
-
557
- test::black_box(&mut n); // pretend to modify `n`
+ let n = test::black_box(1000);
558
559
range(0, n).fold(0, |a, b| a ^ b)
560
})
@@ -569,7 +567,7 @@ Performing either of the above changes gives the following benchmarking results
569
567
570
568
```text
571
running 1 test
572
-test bench_xor_1000_ints ... bench: 1 ns/iter (+/- 0)
+test bench_xor_1000_ints ... bench: 131 ns/iter (+/- 3)
573
574
test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured
575
```
0 commit comments