提交 94d04e68 编写于 作者: J Jorge Aparicio

fix inference fallout

上级 efc97a51
......@@ -66,7 +66,7 @@
//! };
//!
//! // Simple primality tests below our max bound
//! let print_primes = 20;
//! let print_primes = 20u;
//! print!("The primes below {} are: ", print_primes);
//! for x in 0..print_primes {
//! if primes.contains(&x) {
......@@ -2283,7 +2283,7 @@ fn test_bitv_iterator() {
assert_eq!(bitv.iter().collect::<Vec<bool>>(), bools);
let long = (0..10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
let long = (0i32..10000).map(|i| i % 2 == 0).collect::<Vec<_>>();
let bitv: Bitv = long.iter().map(|n| *n).collect();
assert_eq!(bitv.iter().collect::<Vec<bool>>(), long)
}
......
......@@ -2126,7 +2126,7 @@ fn test_into_iter() {
for i in 0i..5 {
d.push_back(i);
}
for i in 6..9 {
for i in 6i..9 {
d.push_front(i);
}
......@@ -2140,7 +2140,7 @@ fn test_into_iter() {
for i in 0i..5 {
d.push_back(i);
}
for i in 6..9 {
for i in 6i..9 {
d.push_front(i);
}
......@@ -2190,7 +2190,7 @@ fn test_drain() {
for i in 0i..5 {
d.push_back(i);
}
for i in 6..9 {
for i in 6i..9 {
d.push_front(i);
}
......@@ -2204,7 +2204,7 @@ fn test_drain() {
for i in 0i..5 {
d.push_back(i);
}
for i in 6..9 {
for i in 6i..9 {
d.push_front(i);
}
......
......@@ -1526,7 +1526,7 @@ fn is_odd(n: &uint) -> bool { *n % 2u == 1u }
#[test]
fn test_from_fn() {
// Test on-stack from_fn.
let mut v = (0..3).map(square).collect::<Vec<_>>();
let mut v = (0u..3).map(square).collect::<Vec<_>>();
{
let v = v.as_slice();
assert_eq!(v.len(), 3u);
......@@ -1536,7 +1536,7 @@ fn test_from_fn() {
}
// Test on-heap from_fn.
v = (0..5).map(square).collect::<Vec<_>>();
v = (0u..5).map(square).collect::<Vec<_>>();
{
let v = v.as_slice();
assert_eq!(v.len(), 5u);
......@@ -2908,7 +2908,7 @@ fn push(b: &mut Bencher) {
#[bench]
fn starts_with_same_vector(b: &mut Bencher) {
let vec: Vec<uint> = (0..100).collect();
let vec: Vec<uint> = (0u..100).collect();
b.iter(|| {
vec.starts_with(vec.as_slice())
})
......@@ -2924,8 +2924,8 @@ fn starts_with_single_element(b: &mut Bencher) {
#[bench]
fn starts_with_diff_one_element_at_end(b: &mut Bencher) {
let vec: Vec<uint> = (0..100).collect();
let mut match_vec: Vec<uint> = (0..99).collect();
let vec: Vec<uint> = (0u..100).collect();
let mut match_vec: Vec<uint> = (0u..99).collect();
match_vec.push(0);
b.iter(|| {
vec.starts_with(match_vec.as_slice())
......@@ -2934,7 +2934,7 @@ fn starts_with_diff_one_element_at_end(b: &mut Bencher) {
#[bench]
fn ends_with_same_vector(b: &mut Bencher) {
let vec: Vec<uint> = (0..100).collect();
let vec: Vec<uint> = (0u..100).collect();
b.iter(|| {
vec.ends_with(vec.as_slice())
})
......@@ -2950,8 +2950,8 @@ fn ends_with_single_element(b: &mut Bencher) {
#[bench]
fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) {
let vec: Vec<uint> = (0..100).collect();
let mut match_vec: Vec<uint> = (0..100).collect();
let vec: Vec<uint> = (0u..100).collect();
let mut match_vec: Vec<uint> = (0u..100).collect();
match_vec.as_mut_slice()[0] = 200;
b.iter(|| {
vec.starts_with(match_vec.as_slice())
......@@ -2960,7 +2960,7 @@ fn ends_with_diff_one_element_at_beginning(b: &mut Bencher) {
#[bench]
fn contains_last_element(b: &mut Bencher) {
let vec: Vec<uint> = (0..100).collect();
let vec: Vec<uint> = (0u..100).collect();
b.iter(|| {
vec.contains(&99u)
})
......
......@@ -1184,7 +1184,7 @@ mod bench {
#[bench]
pub fn vuint_at_A_aligned(b: &mut Bencher) {
let data = (0..4*100).map(|i| {
let data = (0i32..4*100).map(|i| {
match i % 2 {
0 => 0x80u8,
_ => i as u8,
......@@ -1202,7 +1202,7 @@ pub fn vuint_at_A_aligned(b: &mut Bencher) {
#[bench]
pub fn vuint_at_A_unaligned(b: &mut Bencher) {
let data = (0..4*100+1).map(|i| {
let data = (0i32..4*100+1).map(|i| {
match i % 2 {
1 => 0x80u8,
_ => i as u8
......@@ -1220,7 +1220,7 @@ pub fn vuint_at_A_unaligned(b: &mut Bencher) {
#[bench]
pub fn vuint_at_D_aligned(b: &mut Bencher) {
let data = (0..4*100).map(|i| {
let data = (0i32..4*100).map(|i| {
match i % 4 {
0 => 0x10u8,
3 => i as u8,
......@@ -1239,7 +1239,7 @@ pub fn vuint_at_D_aligned(b: &mut Bencher) {
#[bench]
pub fn vuint_at_D_unaligned(b: &mut Bencher) {
let data = (0..4*100+1).map(|i| {
let data = (0i32..4*100+1).map(|i| {
match i % 4 {
1 => 0x10u8,
0 => i as u8,
......
......@@ -2094,18 +2094,18 @@ fn test_reserve_shrink_to_fit() {
m.insert(0u, 0u);
m.remove(&0);
assert!(m.capacity() >= m.len());
for i in 0..128 {
for i in 0us..128 {
m.insert(i, i);
}
m.reserve(256);
let usable_cap = m.capacity();
for i in 128..128+256 {
for i in 128us..128+256 {
m.insert(i, i);
assert_eq!(m.capacity(), usable_cap);
}
for i in 100..128+256 {
for i in 100us..128+256 {
assert_eq!(m.remove(&i), Some(i));
}
m.shrink_to_fit();
......@@ -2114,7 +2114,7 @@ fn test_reserve_shrink_to_fit() {
assert!(!m.is_empty());
assert!(m.capacity() >= m.len());
for i in 0..100 {
for i in 0us..100 {
assert_eq!(m.remove(&i), Some(i));
}
m.shrink_to_fit();
......
......@@ -1198,7 +1198,7 @@ fn test_trivial_drain() {
#[test]
fn test_drain() {
let mut s: HashSet<int> = (1..100).collect();
let mut s: HashSet<int> = (1is..100).collect();
// try this a bunch of times to make sure we don't screw up internal state.
for _ in 0i..20 {
......@@ -1217,7 +1217,7 @@ fn test_drain() {
for _ in s.iter() { panic!("s should be empty!"); }
// reset to try again.
s.extend(1..100);
s.extend(1is..100);
}
}
}
......@@ -939,7 +939,7 @@ pub fn sum_three_items(b: &mut Bencher) {
#[bench]
pub fn sum_many_f64(b: &mut Bencher) {
let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60];
let v = (0..500).map(|i| nums[i%5]).collect::<Vec<_>>();
let v = (0us..500).map(|i| nums[i%5]).collect::<Vec<_>>();
b.iter(|| {
v.sum();
......
......@@ -11,5 +11,5 @@
use std::iter::AdditiveIterator;
fn main() {
let x: [u64; 3] = [1, 2, 3];
assert_eq!(6, (0..3).map(|i| x[i]).sum());
assert_eq!(6, (0us..3).map(|i| x[i]).sum());
}
......@@ -21,7 +21,7 @@ fn to_bytes(&self) -> Vec<u8> {
// the position of this function is significant! - if it comes before methods
// then it works, if it comes after it then it doesn't!
fn to_bools(bitv: Storage) -> Vec<bool> {
(0..8).map(|i| {
(0us..8).map(|i| {
let w = i / 64;
let b = i % 64;
let x = 1u64 & (bitv.storage[w] >> b);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册