move variable down to where it is used

This commit is contained in:
Ralf Jung 2019-04-19 09:06:08 +02:00
parent 29eed6b931
commit 2bc8c547cd

View File

@ -3094,11 +3094,6 @@ mod tests {
fn test_vec_from_vecdeque() {
use crate::vec::Vec;
#[cfg(not(miri))] // Miri is too slow
let max_pwr = 7;
#[cfg(miri)]
let max_pwr = 5;
fn create_vec_and_test_convert(cap: usize, offset: usize, len: usize) {
let mut vd = VecDeque::with_capacity(cap);
for _ in 0..offset {
@ -3112,6 +3107,11 @@ mod tests {
assert!(vec.into_iter().eq(vd));
}
#[cfg(not(miri))] // Miri is too slow
let max_pwr = 7;
#[cfg(miri)]
let max_pwr = 5;
for cap_pwr in 0..max_pwr {
// Make capacity as a (2^x)-1, so that the ring size is 2^x
let cap = (2i32.pow(cap_pwr) - 1) as usize;