Remove i, is, u, or us suffixes that are not necessary.

This commit is contained in:
Niko Matsakis 2015-02-17 09:47:49 -05:00
parent 700c518f2a
commit 2b5720a15f
54 changed files with 174 additions and 174 deletions

@ -27,12 +27,12 @@
//! Some examples of the `format!` extension are:
//!
//! ```
//! format!("Hello"); // => "Hello"
//! format!("Hello, {}!", "world"); // => "Hello, world!"
//! format!("Hello"); // => "Hello"
//! format!("Hello, {}!", "world"); // => "Hello, world!"
//! format!("The number is {}", 1); // => "The number is 1"
//! format!("{:?}", (3, 4)); // => "(3, 4)"
//! format!("{:?}", (3, 4)); // => "(3, 4)"
//! format!("{value}", value=4); // => "4"
//! format!("{} {}", 1, 2u); // => "1 2"
//! format!("{} {}", 1, 2); // => "1 2"
//! ```
//!
//! From these, you can see that the first argument is a format string. It is

@ -441,18 +441,18 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
dst[0] = code as u8;
Some(1)
} else if code < MAX_TWO_B && dst.len() >= 2 {
dst[0] = (code >> 6u & 0x1F_u32) as u8 | TAG_TWO_B;
dst[0] = (code >> 6 & 0x1F_u32) as u8 | TAG_TWO_B;
dst[1] = (code & 0x3F_u32) as u8 | TAG_CONT;
Some(2)
} else if code < MAX_THREE_B && dst.len() >= 3 {
dst[0] = (code >> 12u & 0x0F_u32) as u8 | TAG_THREE_B;
dst[1] = (code >> 6u & 0x3F_u32) as u8 | TAG_CONT;
dst[0] = (code >> 12 & 0x0F_u32) as u8 | TAG_THREE_B;
dst[1] = (code >> 6 & 0x3F_u32) as u8 | TAG_CONT;
dst[2] = (code & 0x3F_u32) as u8 | TAG_CONT;
Some(3)
} else if dst.len() >= 4 {
dst[0] = (code >> 18u & 0x07_u32) as u8 | TAG_FOUR_B;
dst[1] = (code >> 12u & 0x3F_u32) as u8 | TAG_CONT;
dst[2] = (code >> 6u & 0x3F_u32) as u8 | TAG_CONT;
dst[0] = (code >> 18 & 0x07_u32) as u8 | TAG_FOUR_B;
dst[1] = (code >> 12 & 0x3F_u32) as u8 | TAG_CONT;
dst[2] = (code >> 6 & 0x3F_u32) as u8 | TAG_CONT;
dst[3] = (code & 0x3F_u32) as u8 | TAG_CONT;
Some(4)
} else {

@ -1930,7 +1930,7 @@ pub mod types {
pub iSecurityScheme: c_int,
pub dwMessageSize: DWORD,
pub dwProviderReserved: DWORD,
pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1us],
pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
}
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;

@ -713,10 +713,10 @@ pub mod writer {
match size {
1 => w.write_all(&[0x80u8 | (n as u8)]),
2 => w.write_all(&[0x40u8 | ((n >> 8) as u8), n as u8]),
3 => w.write_all(&[0x20u8 | ((n >> 16) as u8), (n >> 8_u) as u8,
3 => w.write_all(&[0x20u8 | ((n >> 16) as u8), (n >> 8) as u8,
n as u8]),
4 => w.write_all(&[0x10u8 | ((n >> 24) as u8), (n >> 16_u) as u8,
(n >> 8_u) as u8, n as u8]),
4 => w.write_all(&[0x10u8 | ((n >> 24) as u8), (n >> 16) as u8,
(n >> 8) as u8, n as u8]),
_ => Err(old_io::IoError {
kind: old_io::OtherIoError,
desc: "int too big",
@ -863,7 +863,7 @@ pub mod writer {
impl<'a, W: Writer + Seek> Encoder<'a, W> {
// used internally to emit things like the vector length and so on
fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) -> EncodeResult {
assert!(v <= 0xFFFF_FFFF_u);
assert!(v <= 0xFFFF_FFFF);
self.wr_tagged_u32(t as uint, v as u32)
}

@ -560,7 +560,7 @@ pub fn parameterized<'tcx,GG>(cx: &ctxt<'tcx>,
pub fn ty_to_short_str<'tcx>(cx: &ctxt<'tcx>, typ: Ty<'tcx>) -> String {
let mut s = typ.repr(cx).to_string();
if s.len() >= 32 {
s = (&s[0u..32]).to_string();
s = (&s[0..32]).to_string();
}
return s;
}

@ -62,7 +62,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
let file = path.filename_str().unwrap();
let file = &file[3..file.len() - 5]; // chop off lib/.rlib
debug!("reading {}", file);
for i in iter::count(0us, 1) {
for i in iter::count(0, 1) {
let bc_encoded = time(sess.time_passes(),
&format!("check for {}.{}.bytecode.deflate", name, i),
(),

@ -443,9 +443,9 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
pub fn env_arg_pos(&self) -> uint {
if self.caller_expects_out_pointer {
1u
1
} else {
0u
0
}
}

@ -467,7 +467,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
PointerCast(bcx, lval.val, type_of::type_of(bcx.ccx(), unsized_ty).ptr_to())
}
ty::UnsizeLength(..) => {
GEPi(bcx, lval.val, &[0u, 0u])
GEPi(bcx, lval.val, &[0, 0])
}
};

@ -76,7 +76,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
let not_empty = ICmp(bcx,
llvm::IntNE,
len,
C_uint(ccx, 0us),
C_uint(ccx, 0_u32),
DebugLoc::None);
with_cond(bcx, not_empty, |bcx| {
let llalign = C_uint(ccx, machine::llalign_of_min(ccx, llty));
@ -436,7 +436,7 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
let loop_counter = {
// i = 0
let i = alloca(loop_bcx, bcx.ccx().int_type(), "__i");
Store(loop_bcx, C_uint(bcx.ccx(), 0us), i);
Store(loop_bcx, C_uint(bcx.ccx(), 0_u32), i);
Br(loop_bcx, cond_bcx.llbb, DebugLoc::None);
i
@ -464,7 +464,7 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
{ // i += 1
let i = Load(inc_bcx, loop_counter);
let plusone = Add(inc_bcx, i, C_uint(bcx.ccx(), 1us), DebugLoc::None);
let plusone = Add(inc_bcx, i, C_uint(bcx.ccx(), 1_u32), DebugLoc::None);
Store(inc_bcx, plusone, loop_counter);
Br(inc_bcx, cond_bcx.llbb, DebugLoc::None);

@ -1149,7 +1149,7 @@ mod tests {
assert_eq!(_20, NumCast::from(20f32).unwrap());
assert_eq!(_20, NumCast::from(20f64).unwrap());
assert_eq!(_20, cast(20u).unwrap());
assert_eq!(_20, cast(20usize).unwrap());
assert_eq!(_20, cast(20u8).unwrap());
assert_eq!(_20, cast(20u16).unwrap());
assert_eq!(_20, cast(20u32).unwrap());
@ -1763,7 +1763,7 @@ mod bench {
#[bench]
fn bench_pow_function(b: &mut Bencher) {
let v = (0..1024u).collect::<Vec<_>>();
b.iter(|| {v.iter().fold(0u, |old, new| old.pow(*new));});
let v = (0..1024).collect::<Vec<_>>();
b.iter(|| {v.iter().fold(0, |old, new| old.pow(*new));});
}
}

@ -262,7 +262,7 @@ pub fn float_to_str_bytes_common<T: Float>(
// If limited digits, calculate one digit more for rounding.
let (limit_digits, digit_count, exact) = match digits {
DigAll => (false, 0u, false),
DigAll => (false, 0, false),
DigMax(count) => (true, count+1, false),
DigExact(count) => (true, count+1, true)
};
@ -289,7 +289,7 @@ pub fn float_to_str_bytes_common<T: Float>(
deccum = num.fract();
if deccum != _0 || (limit_digits && exact && digit_count > 0) {
buf.push(b'.');
let mut dig = 0u;
let mut dig = 0;
// calculate new digits while
// - there is no limit and there are digits left
@ -314,7 +314,7 @@ pub fn float_to_str_bytes_common<T: Float>(
// Decrease the deccumulator one fractional digit at a time
deccum = deccum.fract();
dig += 1u;
dig += 1;
}
// If digits are limited, and that limit has been reached,

@ -25,11 +25,11 @@ mod tests {
#[test]
pub fn test_from_str() {
assert_eq!(from_str::<$T>("0"), Some(0u as $T));
assert_eq!(from_str::<$T>("3"), Some(3u as $T));
assert_eq!(from_str::<$T>("10"), Some(10u as $T));
assert_eq!(from_str::<$T>("0"), Some(0 as $T));
assert_eq!(from_str::<$T>("3"), Some(3 as $T));
assert_eq!(from_str::<$T>("10"), Some(10 as $T));
assert_eq!(from_str::<u32>("123456789"), Some(123456789 as u32));
assert_eq!(from_str::<$T>("00100"), Some(100u as $T));
assert_eq!(from_str::<$T>("00100"), Some(100 as $T));
assert_eq!(from_str::<$T>(""), None);
assert_eq!(from_str::<$T>(" "), None);
@ -38,12 +38,12 @@ mod tests {
#[test]
pub fn test_parse_bytes() {
assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123u as $T));
assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9u as $T));
assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83u as $T));
assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291u as u16));
assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535u as u16));
assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35u as $T));
assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123 as $T));
assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9 as $T));
assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83 as $T));
assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291 as u16));
assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535 as u16));
assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35 as $T));
assert_eq!(FromStrRadix::from_str_radix("Z", 10).ok(), None::<$T>);
assert_eq!(FromStrRadix::from_str_radix("_", 2).ok(), None::<$T>);

@ -85,21 +85,21 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
use mem::transmute;
// LLVM fails to properly optimize this when using shifts instead of the to_le* intrinsics
assert!(size <= 8u);
assert!(size <= 8);
match size {
1u => f(&[n as u8]),
2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }),
4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }),
8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }),
1 => f(&[n as u8]),
2 => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }),
4 => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }),
8 => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }),
_ => {
let mut bytes = vec!();
let mut i = size;
let mut n = n;
while i > 0u {
while i > 0 {
bytes.push((n & 255_u64) as u8);
n >>= 8;
i -= 1u;
i -= 1;
}
f(&bytes)
}
@ -126,19 +126,19 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
use mem::transmute;
// LLVM fails to properly optimize this when using shifts instead of the to_be* intrinsics
assert!(size <= 8u);
assert!(size <= 8);
match size {
1u => f(&[n as u8]),
2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }),
4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }),
8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }),
1 => f(&[n as u8]),
2 => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }),
4 => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }),
8 => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }),
_ => {
let mut bytes = vec!();
let mut i = size;
while i > 0u {
let shift = (i - 1u) * 8u;
while i > 0 {
let shift = (i - 1) * 8;
bytes.push((n >> shift) as u8);
i -= 1u;
i -= 1;
}
f(&bytes)
}
@ -160,7 +160,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
use ptr::{copy_nonoverlapping_memory};
use slice::SliceExt;
assert!(size <= 8u);
assert!(size <= 8);
if data.len() - start < size {
panic!("index out of bounds");

@ -720,7 +720,7 @@ mod test {
let buf = [5 as u8; 100].to_vec();
{
let mut rdr = MemReader::new(buf);
for _i in 0u..10 {
for _i in 0..10 {
let mut buf = [0 as u8; 10];
rdr.read(&mut buf).unwrap();
assert_eq!(buf, [5; 10]);
@ -735,7 +735,7 @@ mod test {
let mut buf = [0 as u8; 100];
{
let mut wr = BufWriter::new(&mut buf);
for _i in 0u..10 {
for _i in 0..10 {
wr.write(&[5; 10]).unwrap();
}
}
@ -749,7 +749,7 @@ mod test {
let buf = [5 as u8; 100];
{
let mut rdr = BufReader::new(&buf);
for _i in 0u..10 {
for _i in 0..10 {
let mut buf = [0 as u8; 10];
rdr.read(&mut buf).unwrap();
assert_eq!(buf, [5; 10]);

@ -1120,37 +1120,37 @@ pub trait Writer {
/// Write a big-endian u64 (8 bytes).
#[inline]
fn write_be_u64(&mut self, n: u64) -> IoResult<()> {
extensions::u64_to_be_bytes(n, 8u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n, 8, |v| self.write_all(v))
}
/// Write a big-endian u32 (4 bytes).
#[inline]
fn write_be_u32(&mut self, n: u32) -> IoResult<()> {
extensions::u64_to_be_bytes(n as u64, 4u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n as u64, 4, |v| self.write_all(v))
}
/// Write a big-endian u16 (2 bytes).
#[inline]
fn write_be_u16(&mut self, n: u16) -> IoResult<()> {
extensions::u64_to_be_bytes(n as u64, 2u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n as u64, 2, |v| self.write_all(v))
}
/// Write a big-endian i64 (8 bytes).
#[inline]
fn write_be_i64(&mut self, n: i64) -> IoResult<()> {
extensions::u64_to_be_bytes(n as u64, 8u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n as u64, 8, |v| self.write_all(v))
}
/// Write a big-endian i32 (4 bytes).
#[inline]
fn write_be_i32(&mut self, n: i32) -> IoResult<()> {
extensions::u64_to_be_bytes(n as u64, 4u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n as u64, 4, |v| self.write_all(v))
}
/// Write a big-endian i16 (2 bytes).
#[inline]
fn write_be_i16(&mut self, n: i16) -> IoResult<()> {
extensions::u64_to_be_bytes(n as u64, 2u, |v| self.write_all(v))
extensions::u64_to_be_bytes(n as u64, 2, |v| self.write_all(v))
}
/// Write a big-endian IEEE754 double-precision floating-point (8 bytes).
@ -1172,37 +1172,37 @@ pub trait Writer {
/// Write a little-endian u64 (8 bytes).
#[inline]
fn write_le_u64(&mut self, n: u64) -> IoResult<()> {
extensions::u64_to_le_bytes(n, 8u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n, 8, |v| self.write_all(v))
}
/// Write a little-endian u32 (4 bytes).
#[inline]
fn write_le_u32(&mut self, n: u32) -> IoResult<()> {
extensions::u64_to_le_bytes(n as u64, 4u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n as u64, 4, |v| self.write_all(v))
}
/// Write a little-endian u16 (2 bytes).
#[inline]
fn write_le_u16(&mut self, n: u16) -> IoResult<()> {
extensions::u64_to_le_bytes(n as u64, 2u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n as u64, 2, |v| self.write_all(v))
}
/// Write a little-endian i64 (8 bytes).
#[inline]
fn write_le_i64(&mut self, n: i64) -> IoResult<()> {
extensions::u64_to_le_bytes(n as u64, 8u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n as u64, 8, |v| self.write_all(v))
}
/// Write a little-endian i32 (4 bytes).
#[inline]
fn write_le_i32(&mut self, n: i32) -> IoResult<()> {
extensions::u64_to_le_bytes(n as u64, 4u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n as u64, 4, |v| self.write_all(v))
}
/// Write a little-endian i16 (2 bytes).
#[inline]
fn write_le_i16(&mut self, n: i16) -> IoResult<()> {
extensions::u64_to_le_bytes(n as u64, 2u, |v| self.write_all(v))
extensions::u64_to_le_bytes(n as u64, 2, |v| self.write_all(v))
}
/// Write a little-endian IEEE754 double-precision floating-point

@ -390,7 +390,7 @@ mod tests {
};
let _t = thread::spawn(move|| {
for _ in 0u..times {
for _ in 0..times {
let mut stream = UnixStream::connect(&path2);
match stream.write(&[100]) {
Ok(..) => {}
@ -555,7 +555,7 @@ mod tests {
tx.send(UnixStream::connect(&addr2).unwrap()).unwrap();
});
let l = rx.recv().unwrap();
for i in 0u..1001 {
for i in 0..1001 {
match a.accept() {
Ok(..) => break,
Err(ref e) if e.kind == TimedOut => {}
@ -683,7 +683,7 @@ mod tests {
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
s.set_timeout(Some(20));
for i in 0u..1001 {
for i in 0..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
@ -727,7 +727,7 @@ mod tests {
assert_eq!(s.read(&mut [0]).err().unwrap().kind, TimedOut);
tx.send(()).unwrap();
for _ in 0u..100 {
for _ in 0..100 {
assert!(s.write(&[0;128 * 1024]).is_ok());
}
}
@ -746,7 +746,7 @@ mod tests {
let mut s = a.accept().unwrap();
s.set_write_timeout(Some(20));
for i in 0u..1001 {
for i in 0..1001 {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,

@ -746,7 +746,7 @@ mod test {
#[test]
fn multiple_connect_serial_ip4() {
let addr = next_test_ip4();
let max = 10u;
let max = 10;
let mut acceptor = TcpListener::bind(addr).listen();
let _t = thread::spawn(move|| {
@ -766,7 +766,7 @@ mod test {
#[test]
fn multiple_connect_serial_ip6() {
let addr = next_test_ip6();
let max = 10u;
let max = 10;
let mut acceptor = TcpListener::bind(addr).listen();
let _t = thread::spawn(move|| {

@ -447,7 +447,7 @@ mod test {
let _b = UdpSocket::bind(addr2).unwrap();
a.set_write_timeout(Some(1000));
for _ in 0u..100 {
for _ in 0..100 {
match a.send_to(&[0;4*1024], addr2) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,

@ -121,7 +121,7 @@ impl Timer {
/// let mut timer = Timer::new().unwrap();
/// let ten_milliseconds = timer.oneshot(Duration::milliseconds(10));
///
/// for _ in 0u..100 { /* do work */ }
/// for _ in 0..100 { /* do work */ }
///
/// // blocks until 10 ms after the `oneshot` call
/// ten_milliseconds.recv().unwrap();
@ -173,12 +173,12 @@ impl Timer {
/// let mut timer = Timer::new().unwrap();
/// let ten_milliseconds = timer.periodic(Duration::milliseconds(10));
///
/// for _ in 0u..100 { /* do work */ }
/// for _ in 0..100 { /* do work */ }
///
/// // blocks until 10 ms after the `periodic` call
/// ten_milliseconds.recv().unwrap();
///
/// for _ in 0u..100 { /* do work */ }
/// for _ in 0..100 { /* do work */ }
///
/// // blocks until 20 ms after the `periodic` call (*not* 10ms after the
/// // previous `recv`)

@ -409,7 +409,7 @@ fn normalize_helper<'a>(v: &'a [u8], is_abs: bool) -> Option<Vec<&'a [u8]>> {
return None;
}
let mut comps: Vec<&'a [u8]> = vec![];
let mut n_up = 0u;
let mut n_up = 0;
let mut changed = false;
for comp in v.split(is_sep_byte) {
if comp.is_empty() { changed = true }

@ -1063,7 +1063,7 @@ fn normalize_helper<'a>(s: &'a str, prefix: Option<PathPrefix>) -> (bool, Option
});
}
let mut comps: Vec<&'a str> = vec![];
let mut n_up = 0u;
let mut n_up = 0;
let mut changed = false;
for comp in s_.split(f) {
if comp.is_empty() { changed = true }

@ -78,7 +78,7 @@ pub fn num_cpus() -> uint {
}
}
pub const TMPBUF_SZ : uint = 1000u;
pub const TMPBUF_SZ : uint = 1000;
/// Returns the current working directory as a `Path`.
///
@ -1442,7 +1442,7 @@ mod tests {
fn make_rand_name() -> String {
let mut rng = rand::thread_rng();
let n = format!("TEST{}", rng.gen_ascii_chars().take(10u)
let n = format!("TEST{}", rng.gen_ascii_chars().take(10)
.collect::<String>());
assert!(getenv(&n).is_none());
n
@ -1522,7 +1522,7 @@ mod tests {
#[ignore]
fn test_env_getenv() {
let e = env();
assert!(e.len() > 0u);
assert!(e.len() > 0);
for p in &e {
let (n, v) = (*p).clone();
debug!("{}", n);

@ -102,7 +102,7 @@
//! let total = 1_000_000;
//! let mut in_circle = 0;
//!
//! for _ in 0u..total {
//! for _ in 0..total {
//! let a = between.ind_sample(&mut rng);
//! let b = between.ind_sample(&mut rng);
//! if a*a + b*b <= 1. {
@ -176,7 +176,7 @@
//! }
//!
//! fn free_doors(blocked: &[uint]) -> Vec<uint> {
//! (0u..3).filter(|x| !blocked.contains(x)).collect()
//! (0..3).filter(|x| !blocked.contains(x)).collect()
//! }
//!
//! fn main() {
@ -483,14 +483,14 @@ mod test {
#[test]
fn test_gen_range() {
let mut r = thread_rng();
for _ in 0u..1000 {
for _ in 0..1000 {
let a = r.gen_range(-3, 42);
assert!(a >= -3 && a < 42);
assert_eq!(r.gen_range(0, 1), 0);
assert_eq!(r.gen_range(-12, -11), -12);
}
for _ in 0u..1000 {
for _ in 0..1000 {
let a = r.gen_range(10, 42);
assert!(a >= 10 && a < 42);
assert_eq!(r.gen_range(0, 1), 0);
@ -510,7 +510,7 @@ mod test {
#[should_fail]
fn test_gen_range_panic_uint() {
let mut r = thread_rng();
r.gen_range(5us, 2us);
r.gen_range(5, 2);
}
#[test]

@ -377,7 +377,7 @@ mod test {
fn test_os_rng_tasks() {
let mut txs = vec!();
for _ in 0u..20 {
for _ in 0..20 {
let (tx, rx) = channel();
txs.push(tx);
@ -391,7 +391,7 @@ mod test {
thread::yield_now();
let mut v = [0u8; 1000];
for _ in 0u..100 {
for _ in 0..100 {
r.next_u32();
thread::yield_now();
r.next_u64();

@ -18,7 +18,7 @@ use sync::{Mutex, Condvar};
/// use std::thread;
///
/// let barrier = Arc::new(Barrier::new(10));
/// for _ in 0u..10 {
/// for _ in 0..10 {
/// let c = barrier.clone();
/// // The same messages will be printed together.
/// // You will NOT see any interleaving.
@ -120,7 +120,7 @@ mod tests {
let barrier = Arc::new(Barrier::new(N));
let (tx, rx) = channel();
for _ in 0u..N - 1 {
for _ in 0..N - 1 {
let c = barrier.clone();
let tx = tx.clone();
thread::spawn(move|| {
@ -138,7 +138,7 @@ mod tests {
let mut leader_found = barrier.wait().is_leader();
// Now, the barrier is cleared and we should get data.
for _ in 0u..N - 1 {
for _ in 0..N - 1 {
if rx.recv().unwrap() {
assert!(!leader_found);
leader_found = true;

@ -1147,9 +1147,9 @@ mod test {
fn stress() {
let (tx, rx) = channel::<int>();
let t = thread::spawn(move|| {
for _ in 0u..10000 { tx.send(1).unwrap(); }
for _ in 0..10000 { tx.send(1).unwrap(); }
});
for _ in 0u..10000 {
for _ in 0..10000 {
assert_eq!(rx.recv().unwrap(), 1);
}
t.join().ok().unwrap();
@ -1209,7 +1209,7 @@ mod test {
assert_eq!(rx.recv().unwrap(), 1);
}
});
for _ in 0u..40 {
for _ in 0..40 {
tx.send(1).unwrap();
}
t.join().ok().unwrap();
@ -1530,7 +1530,7 @@ mod test {
tx2.send(()).unwrap();
});
// make sure the other task has gone to sleep
for _ in 0u..5000 { thread::yield_now(); }
for _ in 0..5000 { thread::yield_now(); }
// upgrade to a shared chan and send a message
let t = tx.clone();
@ -1654,9 +1654,9 @@ mod sync_tests {
fn stress() {
let (tx, rx) = sync_channel::<int>(0);
thread::spawn(move|| {
for _ in 0u..10000 { tx.send(1).unwrap(); }
for _ in 0..10000 { tx.send(1).unwrap(); }
});
for _ in 0u..10000 {
for _ in 0..10000 {
assert_eq!(rx.recv().unwrap(), 1);
}
}
@ -1893,8 +1893,8 @@ mod sync_tests {
fn recv_a_lot() {
// Regression test that we don't run out of stack in scheduler context
let (tx, rx) = sync_channel(10000);
for _ in 0u..10000 { tx.send(()).unwrap(); }
for _ in 0u..10000 { rx.recv().unwrap(); }
for _ in 0..10000 { tx.send(()).unwrap(); }
for _ in 0..10000 { rx.recv().unwrap(); }
}
#[test]
@ -1994,7 +1994,7 @@ mod sync_tests {
tx2.send(()).unwrap();
});
// make sure the other task has gone to sleep
for _ in 0u..5000 { thread::yield_now(); }
for _ in 0..5000 { thread::yield_now(); }
// upgrade to a shared chan and send a message
let t = tx.clone();
@ -2082,7 +2082,7 @@ mod sync_tests {
rx2.recv().unwrap();
}
for _ in 0u..100 {
for _ in 0..100 {
repro()
}
}

@ -171,8 +171,8 @@ mod tests {
#[test]
fn test() {
let nthreads = 8u;
let nmsgs = 1000u;
let nthreads = 8;
let nmsgs = 1000;
let q = Queue::new();
match q.pop() {
Empty => {}
@ -192,7 +192,7 @@ mod tests {
});
}
let mut i = 0u;
let mut i = 0;
while i < nthreads * nmsgs {
match q.pop() {
Empty | Inconsistent => {},

@ -428,10 +428,10 @@ mod test {
let (tx3, rx3) = channel::<int>();
let _t = thread::spawn(move|| {
for _ in 0u..20 { thread::yield_now(); }
for _ in 0..20 { thread::yield_now(); }
tx1.send(1).unwrap();
rx3.recv().unwrap();
for _ in 0u..20 { thread::yield_now(); }
for _ in 0..20 { thread::yield_now(); }
});
select! {
@ -452,7 +452,7 @@ mod test {
let (tx3, rx3) = channel::<()>();
let _t = thread::spawn(move|| {
for _ in 0u..20 { thread::yield_now(); }
for _ in 0..20 { thread::yield_now(); }
tx1.send(1).unwrap();
tx2.send(2).unwrap();
rx3.recv().unwrap();
@ -557,7 +557,7 @@ mod test {
tx3.send(()).unwrap();
});
for _ in 0u..1000 { thread::yield_now(); }
for _ in 0..1000 { thread::yield_now(); }
drop(tx1.clone());
tx2.send(()).unwrap();
rx3.recv().unwrap();
@ -670,7 +670,7 @@ mod test {
tx2.send(()).unwrap();
});
for _ in 0u..100 { thread::yield_now() }
for _ in 0..100 { thread::yield_now() }
tx1.send(()).unwrap();
rx2.recv().unwrap();
}
@ -690,7 +690,7 @@ mod test {
tx2.send(()).unwrap();
});
for _ in 0u..100 { thread::yield_now() }
for _ in 0..100 { thread::yield_now() }
tx1.send(()).unwrap();
rx2.recv().unwrap();
}
@ -709,7 +709,7 @@ mod test {
tx2.send(()).unwrap();
});
for _ in 0u..100 { thread::yield_now() }
for _ in 0..100 { thread::yield_now() }
tx1.send(()).unwrap();
rx2.recv().unwrap();
}
@ -727,7 +727,7 @@ mod test {
fn sync2() {
let (tx, rx) = sync_channel::<int>(0);
let _t = thread::spawn(move|| {
for _ in 0u..100 { thread::yield_now() }
for _ in 0..100 { thread::yield_now() }
tx.send(1).unwrap();
});
select! {

@ -325,7 +325,7 @@ mod test {
let (tx, rx) = channel();
let q2 = q.clone();
let _t = thread::spawn(move|| {
for _ in 0u..100000 {
for _ in 0..100000 {
loop {
match q2.pop() {
Some(1) => break,

@ -60,7 +60,7 @@ use sys_common::mutex as sys;
/// let data = Arc::new(Mutex::new(0));
///
/// let (tx, rx) = channel();
/// for _ in 0u..10 {
/// for _ in 0..10 {
/// let (data, tx) = (data.clone(), tx.clone());
/// thread::spawn(move || {
/// // The shared static can only be accessed once the lock is held.
@ -87,7 +87,7 @@ use sys_common::mutex as sys;
/// use std::sync::{Arc, Mutex};
/// use std::thread;
///
/// let lock = Arc::new(Mutex::new(0u));
/// let lock = Arc::new(Mutex::new(0_u32));
/// let lock2 = lock.clone();
///
/// let _ = thread::spawn(move || -> () {

@ -147,10 +147,10 @@ mod test {
static mut run: bool = false;
let (tx, rx) = channel();
for _ in 0u..10 {
for _ in 0..10 {
let tx = tx.clone();
thread::spawn(move|| {
for _ in 0u..4 { thread::yield_now() }
for _ in 0..4 { thread::yield_now() }
unsafe {
O.call_once(|| {
assert!(!run);
@ -170,7 +170,7 @@ mod test {
assert!(run);
}
for _ in 0u..10 {
for _ in 0..10 {
rx.recv().unwrap();
}
}

@ -503,7 +503,7 @@ mod tests {
thread::spawn(move|| {
let mut lock = arc2.write().unwrap();
for _ in 0u..10 {
for _ in 0..10 {
let tmp = *lock;
*lock = -1;
thread::yield_now();
@ -514,7 +514,7 @@ mod tests {
// Readers try to catch the writer in the act
let mut children = Vec::new();
for _ in 0u..5 {
for _ in 0..5 {
let arc3 = arc.clone();
children.push(thread::spawn(move|| {
let lock = arc3.read().unwrap();

@ -63,17 +63,17 @@ impl<'a> Drop for Sentinel<'a> {
/// use std::iter::AdditiveIterator;
/// use std::sync::mpsc::channel;
///
/// let pool = TaskPool::new(4u);
/// let pool = TaskPool::new(4);
///
/// let (tx, rx) = channel();
/// for _ in 0..8u {
/// for _ in 0..8 {
/// let tx = tx.clone();
/// pool.execute(move|| {
/// tx.send(1u).unwrap();
/// tx.send(1_u32).unwrap();
/// });
/// }
///
/// assert_eq!(rx.iter().take(8u).sum(), 8u);
/// assert_eq!(rx.iter().take(8).sum(), 8);
/// ```
pub struct TaskPool {
// How the threadpool communicates with subthreads.
@ -142,7 +142,7 @@ mod test {
use super::*;
use sync::mpsc::channel;
const TEST_TASKS: uint = 4u;
const TEST_TASKS: uint = 4;
#[test]
fn test_works() {
@ -154,7 +154,7 @@ mod test {
for _ in 0..TEST_TASKS {
let tx = tx.clone();
pool.execute(move|| {
tx.send(1u).unwrap();
tx.send(1).unwrap();
});
}
@ -183,7 +183,7 @@ mod test {
for _ in 0..TEST_TASKS {
let tx = tx.clone();
pool.execute(move|| {
tx.send(1u).unwrap();
tx.send(1).unwrap();
});
}

@ -175,13 +175,13 @@ pub fn current_exe() -> IoResult<Path> {
let mut sz: libc::size_t = 0;
let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
ptr::null_mut(), &mut sz, ptr::null_mut(),
0u as libc::size_t);
0 as libc::size_t);
if err != 0 { return Err(IoError::last_error()); }
if sz == 0 { return Err(IoError::last_error()); }
let mut v: Vec<u8> = Vec::with_capacity(sz as uint);
let err = sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint,
v.as_mut_ptr() as *mut libc::c_void, &mut sz,
ptr::null_mut(), 0u as libc::size_t);
ptr::null_mut(), 0 as libc::size_t);
if err != 0 { return Err(IoError::last_error()); }
if sz == 0 { return Err(IoError::last_error()); }
v.set_len(sz as uint - 1); // chop off trailing NUL

@ -105,7 +105,7 @@ pub struct WSAPROTOCOL_INFO {
pub iSecurityScheme: libc::c_int,
pub dwMessageSize: libc::DWORD,
pub dwProviderReserved: libc::DWORD,
pub szProtocol: [u16; (WSAPROTOCOL_LEN as usize) + 1us],
pub szProtocol: [u16; (WSAPROTOCOL_LEN as usize) + 1],
}
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;

@ -388,7 +388,7 @@ fn make_command_line(prog: &CString, args: &[CString]) -> String {
cmd.push('"');
}
let argvec: Vec<char> = arg.chars().collect();
for i in 0u..argvec.len() {
for i in 0..argvec.len() {
append_char_at(cmd, &argvec, i);
}
if quote {

@ -488,7 +488,7 @@ pub fn parse(sess: &ParseSess,
let match_cur = ei.match_cur;
(&mut ei.matches[match_cur]).push(Rc::new(MatchedNonterminal(
parse_nt(&mut rust_parser, span, &name_string))));
ei.idx += 1us;
ei.idx += 1;
ei.match_cur += 1;
}
_ => panic!()

@ -168,7 +168,7 @@ pub fn mk_printer(out: Box<old_io::Writer+'static>, linewidth: usize) -> Printer
debug!("mk_printer {}", linewidth);
let token: Vec<Token> = repeat(Token::Eof).take(n).collect();
let size: Vec<isize> = repeat(0).take(n).collect();
let scan_stack: Vec<usize> = repeat(0us).take(n).collect();
let scan_stack: Vec<usize> = repeat(0).take(n).collect();
Printer {
out: out,
buf_len: n,

@ -185,7 +185,7 @@ pub fn parse(file: &mut old_io::Reader, longnames: bool)
let magic = try!(file.read_le_u16());
if magic != 0x011A {
return Err(format!("invalid magic number: expected {:x}, found {:x}",
0x011Au, magic as uint));
0x011A as usize, magic as usize));
}
let names_bytes = try!(file.read_le_i16()) as int;

@ -939,7 +939,7 @@ mod bench {
#[bench]
pub fn sum_many_f64(b: &mut Bencher) {
let nums = [-1e30f64, 1e60, 1e30, 1.0, -1e60];
let v = (0us..500).map(|i| nums[i%5]).collect::<Vec<_>>();
let v = (0..500).map(|i| nums[i%5]).collect::<Vec<_>>();
b.iter(|| {
v.sum();

@ -143,9 +143,9 @@ pub fn parse_summary<R: Reader>(input: R, src: &Path) -> Result<Book, Vec<String
path_to_root: path_to_root,
children: vec!(),
};
let level = indent.chars().map(|c| {
let level = indent.chars().map(|c| -> usize {
match c {
' ' => 1us,
' ' => 1,
'\t' => 4,
_ => unreachable!()
}

@ -14,4 +14,4 @@ fn bad_bang(i: usize) -> ! {
return 7us; //~ ERROR `return` in a function declared as diverging [E0166]
}
fn main() { bad_bang(5us); }
fn main() { bad_bang(5); }

@ -14,4 +14,4 @@ fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function ma
if i < 0us { } else { panic!(); }
}
fn main() { bad_bang(5us); }
fn main() { bad_bang(5); }

@ -11,11 +11,11 @@
use std::iter::repeat;
fn main() {
let mut vector = vec![1us, 2];
let mut vector = vec![1, 2];
for &x in &vector {
let cap = vector.capacity();
vector.extend(repeat(0)); //~ ERROR cannot borrow
vector[1us] = 5us; //~ ERROR cannot borrow
vector[1] = 5; //~ ERROR cannot borrow
}
}

@ -14,4 +14,4 @@ fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function ma
println!("{}", 3);
}
fn main() { bad_bang(5us); }
fn main() { bad_bang(5); }

@ -15,21 +15,21 @@
//error-pattern: unreachable
fn main() {
match 5us {
1us ... 10us => { }
5us ... 6us => { }
match 5 {
1 ... 10 => { }
5 ... 6 => { }
_ => {}
};
match 5us {
3us ... 6us => { }
4us ... 6us => { }
match 5 {
3 ... 6 => { }
4 ... 6 => { }
_ => {}
};
match 5us {
4us ... 6us => { }
4us ... 6us => { }
match 5 {
4 ... 6 => { }
4 ... 6 => { }
_ => {}
};

@ -13,8 +13,8 @@
//error-pattern: mismatched types
fn main() {
match 5us {
6us ... 1us => { }
match 5 {
6 ... 1 => { }
_ => { }
};
@ -22,8 +22,8 @@ fn main() {
"bar" ... "foo" => { }
};
match 5us {
'c' ... 100us => { }
match 5 {
'c' ... 100 => { }
_ => { }
};
}

@ -14,7 +14,7 @@
fn test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
fn test2() -> (_, _) { (5us, 5us) }
fn test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures
@ -67,7 +67,7 @@ pub fn main() {
fn fn_test() -> _ { 5 }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
fn fn_test2() -> (_, _) { (5us, 5us) }
fn fn_test2() -> (_, _) { (5, 5) }
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
//~^^ ERROR the type placeholder `_` is not allowed within types on item signatures

@ -16,6 +16,6 @@ struct Foo<'a, T:'a> {
}
pub fn main() {
let c: Foo<_, _> = Foo { r: &5us };
let c: Foo<_, _> = Foo { r: &5 };
//~^ ERROR wrong number of type arguments: expected 1, found 2
}

@ -83,8 +83,8 @@ pub type Foo = [i32; (3us as usize)];
pub struct Bar {
pub x: [i32; (3us as usize)],
}
pub struct TupleBar([i32; (4us as usize)]);
pub enum Baz { BazVariant([i32; (5us as usize)]), }
pub struct TupleBar([i32; (4 as usize)]);
pub enum Baz { BazVariant([i32; (5 as usize)]), }
pub fn id<T>(x: T) -> T { (x as T) }
pub fn use_id() {
let _ =

@ -17,7 +17,7 @@
pub fn foo(_: [i32; 3]) {}
pub fn bar() {
const FOO: usize = 5us - 4us;
const FOO: usize = 5 - 4;
let _: [(); FOO] = [()];
let _ : [(); 1us] = [()];
@ -27,22 +27,22 @@ pub fn bar() {
format!("test");
}
pub type Foo = [i32; 3us];
pub type Foo = [i32; 3];
pub struct Bar {
pub x: [i32; 3us]
pub x: [i32; 3]
}
pub struct TupleBar([i32; 4us]);
pub struct TupleBar([i32; 4]);
pub enum Baz {
BazVariant([i32; 5us])
BazVariant([i32; 5])
}
pub fn id<T>(x: T) -> T { x }
pub fn use_id() {
let _ = id::<[i32; 3us]>([1,2,3]);
let _ = id::<[i32; 3]>([1,2,3]);
}

@ -14,7 +14,7 @@ use sub::sub2 as msalias;
use sub::sub2;
use std::old_io::stdio::println;
static yy: usize = 25us;
static yy: usize = 25;
mod sub {
pub mod sub2 {

@ -32,7 +32,7 @@ use std::num::{from_int,from_i8,from_i32};
use std::mem::size_of;
static uni: &'static str = "Les Miséééééééérables";
static yy: usize = 25us;
static yy: usize = 25;
static bob: Option<std::vec::CowVec<'static, isize>> = None;

@ -11,7 +11,7 @@
use std::sync::Arc;
fn main() {
let x = 5us;
let x = 5;
let command = Arc::new(Box::new(|| { x*2 }));
assert_eq!(command(), 10);
}