diff options
| author | bors <bors@rust-lang.org> | 2014-04-02 16:36:50 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-02 16:36:50 -0700 |
| commit | f503f6c0b90e69425952ddc3ee3c6022be769ace (patch) | |
| tree | 07ce928ee77fea3d2b0a1d0bbfe021038bd0d708 /src/libstd | |
| parent | 3786b552a6ffd2219d8e42df6f8db6cc386cce56 (diff) | |
| parent | 9a259f4303cd6550a38ccd12b07ae14c1e21a263 (diff) | |
| download | rust-f503f6c0b90e69425952ddc3ee3c6022be769ace.tar.gz rust-f503f6c0b90e69425952ddc3ee3c6022be769ace.zip | |
auto merge of #13257 : alexcrichton/rust/index-uint, r=pnkfelix
The details are outlined in the first commit. Closes #10453
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ascii.rs | 18 | ||||
| -rw-r--r-- | src/libstd/comm/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/hash/sip.rs | 2 | ||||
| -rw-r--r-- | src/libstd/io/test.rs | 2 | ||||
| -rw-r--r-- | src/libstd/num/mod.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/strconv.rs | 12 | ||||
| -rw-r--r-- | src/libstd/slice.rs | 4 | ||||
| -rw-r--r-- | src/libstd/str.rs | 6 |
8 files changed, 26 insertions, 24 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index c9112caa1b9..a52658da209 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -43,19 +43,19 @@ impl Ascii { /// Convert to lowercase. #[inline] pub fn to_lower(self) -> Ascii { - Ascii{chr: ASCII_LOWER_MAP[self.chr]} + Ascii{chr: ASCII_LOWER_MAP[self.chr as uint]} } /// Convert to uppercase. #[inline] pub fn to_upper(self) -> Ascii { - Ascii{chr: ASCII_UPPER_MAP[self.chr]} + Ascii{chr: ASCII_UPPER_MAP[self.chr as uint]} } /// Compares two ascii characters of equality, ignoring case. #[inline] pub fn eq_ignore_case(self, other: Ascii) -> bool { - ASCII_LOWER_MAP[self.chr] == ASCII_LOWER_MAP[other.chr] + ASCII_LOWER_MAP[self.chr as uint] == ASCII_LOWER_MAP[other.chr as uint] } // the following methods are like ctype, and the implementation is inspired by musl @@ -370,8 +370,12 @@ impl<'a> StrAsciiExt for &'a str { #[inline] fn eq_ignore_ascii_case(&self, other: &str) -> bool { - self.len() == other.len() && self.as_bytes().iter().zip(other.as_bytes().iter()).all( - |(byte_self, byte_other)| ASCII_LOWER_MAP[*byte_self] == ASCII_LOWER_MAP[*byte_other]) + self.len() == other.len() && + self.as_bytes().iter().zip(other.as_bytes().iter()).all( + |(byte_self, byte_other)| { + ASCII_LOWER_MAP[*byte_self as uint] == + ASCII_LOWER_MAP[*byte_other as uint] + }) } } @@ -392,7 +396,7 @@ unsafe fn str_map_bytes(string: ~str, map: &'static [u8]) -> ~str { let mut bytes = string.into_bytes(); for b in bytes.mut_iter() { - *b = map[*b]; + *b = map[*b as uint]; } str::raw::from_utf8_owned(bytes) @@ -400,7 +404,7 @@ unsafe fn str_map_bytes(string: ~str, map: &'static [u8]) -> ~str { #[inline] unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> ~str { - let bytes = string.bytes().map(|b| map[b]).collect::<~[_]>(); + let bytes = string.bytes().map(|b| map[b as uint]).collect::<~[_]>(); str::raw::from_utf8_owned(bytes) } diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index e951077ac83..d01c4913b32 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -254,7 +254,7 @@ pub use comm::select::{Select, Handle}; macro_rules! test ( { fn $name:ident() $b:block $(#[$a:meta])*} => ( mod $name { - #[allow(unused_imports)]; + #![allow(unused_imports)] use native; use comm::*; diff --git a/src/libstd/hash/sip.rs b/src/libstd/hash/sip.rs index d780c30d850..6217ff0f58c 100644 --- a/src/libstd/hash/sip.rs +++ b/src/libstd/hash/sip.rs @@ -432,7 +432,7 @@ mod tests { assert!(f == i && f == v); buf.push(t as u8); - state_inc.write_u8(t); + state_inc.write_u8(t as u8); t += 1; } diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index d5bd7ad24f8..14b9b5c1e06 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -21,7 +21,7 @@ use sync::atomics::{AtomicUint, INIT_ATOMIC_UINT, Relaxed}; macro_rules! iotest ( { fn $name:ident() $b:block $(#[$a:meta])* } => ( mod $name { - #[allow(unused_imports)]; + #![allow(unused_imports)] use super::super::*; use super::*; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 2c628112957..761bd072bf8 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -1655,7 +1655,7 @@ mod tests { macro_rules! test_next_power_of_two( ($test_name:ident, $T:ident) => ( fn $test_name() { - #[test]; + #![test] assert_eq!(next_power_of_two::<$T>(0), 0); let mut next_power = 1; for i in range::<$T>(1, 40) { @@ -1675,7 +1675,7 @@ mod tests { macro_rules! test_checked_next_power_of_two( ($test_name:ident, $T:ident) => ( fn $test_name() { - #[test]; + #![test] assert_eq!(checked_next_power_of_two::<$T>(0), None); let mut next_power = 1; for i in range::<$T>(1, 40) { diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 15c7b251fa7..b15b5872fc2 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -411,23 +411,23 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+Round+ // If reached left end of number, have to // insert additional digit: if i < 0 - || buf[i] == '-' as u8 - || buf[i] == '+' as u8 { + || buf[i as uint] == '-' as u8 + || buf[i as uint] == '+' as u8 { buf.insert((i + 1) as uint, value2ascii(1)); break; } // Skip the '.' - if buf[i] == '.' as u8 { i -= 1; continue; } + if buf[i as uint] == '.' as u8 { i -= 1; continue; } // Either increment the digit, // or set to 0 if max and carry the 1. - let current_digit = ascii2value(buf[i]); + let current_digit = ascii2value(buf[i as uint]); if current_digit < (radix - 1) { - buf[i] = value2ascii(current_digit+1); + buf[i as uint] = value2ascii(current_digit+1); break; } else { - buf[i] = value2ascii(0); + buf[i as uint] = value2ascii(0); i -= 1; } } diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index 3e1f62da039..f15e3e61ca1 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -2922,8 +2922,6 @@ mod tests { fn square(n: uint) -> uint { n * n } - fn square_ref(n: &uint) -> uint { square(*n) } - fn is_odd(n: &uint) -> bool { *n % 2u == 1u } #[test] @@ -4441,7 +4439,7 @@ mod bench { unsafe { v.set_len(1024); } - for i in range(0, 1024) { + for i in range(0u, 1024) { v[i] = 0; } }); diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 408d236ccc6..1d80af70b97 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -1053,7 +1053,7 @@ static UTF8_CHAR_WIDTH: [u8, ..256] = [ /// Given a first byte, determine how many bytes are in this UTF-8 character #[inline] pub fn utf8_char_width(b: u8) -> uint { - return UTF8_CHAR_WIDTH[b] as uint; + return UTF8_CHAR_WIDTH[b as uint] as uint; } /// Struct that contains a `char` and the index of the first byte of @@ -2636,7 +2636,7 @@ impl<'a> StrSlice<'a> for &'a str { // Multibyte case is a fn to allow char_range_at to inline cleanly fn multibyte_char_range_at(s: &str, i: uint) -> CharRange { let mut val = s[i] as u32; - let w = UTF8_CHAR_WIDTH[val] as uint; + let w = UTF8_CHAR_WIDTH[val as uint] as uint; assert!((w != 0)); val = utf8_first_byte!(val, w); @@ -2665,7 +2665,7 @@ impl<'a> StrSlice<'a> for &'a str { } let mut val = s[i] as u32; - let w = UTF8_CHAR_WIDTH[val] as uint; + let w = UTF8_CHAR_WIDTH[val as uint] as uint; assert!((w != 0)); val = utf8_first_byte!(val, w); |
