File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ fn bench_contains_short_short(b: &mut Bencher) {
123123 let needle = "sit" ;
124124
125125 b. iter ( || {
126- assert ! ( haystack. contains( needle) ) ;
126+ assert ! ( black_box ( haystack) . contains( black_box ( needle) ) ) ;
127127 } )
128128}
129129
@@ -167,7 +167,7 @@ malesuada sollicitudin quam eu fermentum.";
167167 let needle = "english" ;
168168
169169 b. iter ( || {
170- assert ! ( !haystack. contains( needle) ) ;
170+ assert ! ( !black_box ( haystack) . contains( black_box ( needle) ) ) ;
171171 } )
172172}
173173
@@ -177,7 +177,7 @@ fn bench_contains_bad_naive(b: &mut Bencher) {
177177 let needle = "aaaaaaaab" ;
178178
179179 b. iter ( || {
180- assert ! ( !haystack. contains( needle) ) ;
180+ assert ! ( !black_box ( haystack) . contains( black_box ( needle) ) ) ;
181181 } )
182182}
183183
@@ -187,7 +187,7 @@ fn bench_contains_equal(b: &mut Bencher) {
187187 let needle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." ;
188188
189189 b. iter ( || {
190- assert ! ( haystack. contains( needle) ) ;
190+ assert ! ( black_box ( haystack) . contains( black_box ( needle) ) ) ;
191191 } )
192192}
193193
You can’t perform that action at this time.
0 commit comments