Skip to content

Commit 2b5720a

Browse files
committed
Remove i, is, u, or us suffixes that are not necessary.
1 parent 700c518 commit 2b5720a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+174
-174
lines changed

src/libcollections/fmt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
//! Some examples of the `format!` extension are:
2828
//!
2929
//! ```
30-
//! format!("Hello"); // => "Hello"
31-
//! format!("Hello, {}!", "world"); // => "Hello, world!"
30+
//! format!("Hello"); // => "Hello"
31+
//! format!("Hello, {}!", "world"); // => "Hello, world!"
3232
//! format!("The number is {}", 1); // => "The number is 1"
33-
//! format!("{:?}", (3, 4)); // => "(3, 4)"
33+
//! format!("{:?}", (3, 4)); // => "(3, 4)"
3434
//! format!("{value}", value=4); // => "4"
35-
//! format!("{} {}", 1, 2u); // => "1 2"
35+
//! format!("{} {}", 1, 2); // => "1 2"
3636
//! ```
3737
//!
3838
//! From these, you can see that the first argument is a format string. It is

src/libcore/char.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,18 +441,18 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<usize> {
441441
dst[0] = code as u8;
442442
Some(1)
443443
} else if code < MAX_TWO_B && dst.len() >= 2 {
444-
dst[0] = (code >> 6u & 0x1F_u32) as u8 | TAG_TWO_B;
444+
dst[0] = (code >> 6 & 0x1F_u32) as u8 | TAG_TWO_B;
445445
dst[1] = (code & 0x3F_u32) as u8 | TAG_CONT;
446446
Some(2)
447447
} else if code < MAX_THREE_B && dst.len() >= 3 {
448-
dst[0] = (code >> 12u & 0x0F_u32) as u8 | TAG_THREE_B;
449-
dst[1] = (code >> 6u & 0x3F_u32) as u8 | TAG_CONT;
448+
dst[0] = (code >> 12 & 0x0F_u32) as u8 | TAG_THREE_B;
449+
dst[1] = (code >> 6 & 0x3F_u32) as u8 | TAG_CONT;
450450
dst[2] = (code & 0x3F_u32) as u8 | TAG_CONT;
451451
Some(3)
452452
} else if dst.len() >= 4 {
453-
dst[0] = (code >> 18u & 0x07_u32) as u8 | TAG_FOUR_B;
454-
dst[1] = (code >> 12u & 0x3F_u32) as u8 | TAG_CONT;
455-
dst[2] = (code >> 6u & 0x3F_u32) as u8 | TAG_CONT;
453+
dst[0] = (code >> 18 & 0x07_u32) as u8 | TAG_FOUR_B;
454+
dst[1] = (code >> 12 & 0x3F_u32) as u8 | TAG_CONT;
455+
dst[2] = (code >> 6 & 0x3F_u32) as u8 | TAG_CONT;
456456
dst[3] = (code & 0x3F_u32) as u8 | TAG_CONT;
457457
Some(4)
458458
} else {

src/liblibc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ pub mod types {
19301930
pub iSecurityScheme: c_int,
19311931
pub dwMessageSize: DWORD,
19321932
pub dwProviderReserved: DWORD,
1933-
pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1us],
1933+
pub szProtocol: [u8; WSAPROTOCOL_LEN as usize + 1],
19341934
}
19351935

19361936
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;

src/librbml/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,10 @@ pub mod writer {
713713
match size {
714714
1 => w.write_all(&[0x80u8 | (n as u8)]),
715715
2 => w.write_all(&[0x40u8 | ((n >> 8) as u8), n as u8]),
716-
3 => w.write_all(&[0x20u8 | ((n >> 16) as u8), (n >> 8_u) as u8,
716+
3 => w.write_all(&[0x20u8 | ((n >> 16) as u8), (n >> 8) as u8,
717717
n as u8]),
718-
4 => w.write_all(&[0x10u8 | ((n >> 24) as u8), (n >> 16_u) as u8,
719-
(n >> 8_u) as u8, n as u8]),
718+
4 => w.write_all(&[0x10u8 | ((n >> 24) as u8), (n >> 16) as u8,
719+
(n >> 8) as u8, n as u8]),
720720
_ => Err(old_io::IoError {
721721
kind: old_io::OtherIoError,
722722
desc: "int too big",
@@ -863,7 +863,7 @@ pub mod writer {
863863
impl<'a, W: Writer + Seek> Encoder<'a, W> {
864864
// used internally to emit things like the vector length and so on
865865
fn _emit_tagged_uint(&mut self, t: EbmlEncoderTag, v: uint) -> EncodeResult {
866-
assert!(v <= 0xFFFF_FFFF_u);
866+
assert!(v <= 0xFFFF_FFFF);
867867
self.wr_tagged_u32(t as uint, v as u32)
868868
}
869869

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ pub fn parameterized<'tcx,GG>(cx: &ctxt<'tcx>,
560560
pub fn ty_to_short_str<'tcx>(cx: &ctxt<'tcx>, typ: Ty<'tcx>) -> String {
561561
let mut s = typ.repr(cx).to_string();
562562
if s.len() >= 32 {
563-
s = (&s[0u..32]).to_string();
563+
s = (&s[0..32]).to_string();
564564
}
565565
return s;
566566
}

src/librustc_trans/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
6262
let file = path.filename_str().unwrap();
6363
let file = &file[3..file.len() - 5]; // chop off lib/.rlib
6464
debug!("reading {}", file);
65-
for i in iter::count(0us, 1) {
65+
for i in iter::count(0, 1) {
6666
let bc_encoded = time(sess.time_passes(),
6767
&format!("check for {}.{}.bytecode.deflate", name, i),
6868
(),

src/librustc_trans/trans/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
443443

444444
pub fn env_arg_pos(&self) -> uint {
445445
if self.caller_expects_out_pointer {
446-
1u
446+
1
447447
} else {
448-
0u
448+
0
449449
}
450450
}
451451

src/librustc_trans/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
467467
PointerCast(bcx, lval.val, type_of::type_of(bcx.ccx(), unsized_ty).ptr_to())
468468
}
469469
ty::UnsizeLength(..) => {
470-
GEPi(bcx, lval.val, &[0u, 0u])
470+
GEPi(bcx, lval.val, &[0, 0])
471471
}
472472
};
473473

src/librustc_trans/trans/tvec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
7676
let not_empty = ICmp(bcx,
7777
llvm::IntNE,
7878
len,
79-
C_uint(ccx, 0us),
79+
C_uint(ccx, 0_u32),
8080
DebugLoc::None);
8181
with_cond(bcx, not_empty, |bcx| {
8282
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>,
436436
let loop_counter = {
437437
// i = 0
438438
let i = alloca(loop_bcx, bcx.ccx().int_type(), "__i");
439-
Store(loop_bcx, C_uint(bcx.ccx(), 0us), i);
439+
Store(loop_bcx, C_uint(bcx.ccx(), 0_u32), i);
440440

441441
Br(loop_bcx, cond_bcx.llbb, DebugLoc::None);
442442
i
@@ -464,7 +464,7 @@ pub fn iter_vec_loop<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
464464

465465
{ // i += 1
466466
let i = Load(inc_bcx, loop_counter);
467-
let plusone = Add(inc_bcx, i, C_uint(bcx.ccx(), 1us), DebugLoc::None);
467+
let plusone = Add(inc_bcx, i, C_uint(bcx.ccx(), 1_u32), DebugLoc::None);
468468
Store(inc_bcx, plusone, loop_counter);
469469

470470
Br(inc_bcx, cond_bcx.llbb, DebugLoc::None);

src/libstd/num/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ mod tests {
11491149
assert_eq!(_20, NumCast::from(20f32).unwrap());
11501150
assert_eq!(_20, NumCast::from(20f64).unwrap());
11511151

1152-
assert_eq!(_20, cast(20u).unwrap());
1152+
assert_eq!(_20, cast(20usize).unwrap());
11531153
assert_eq!(_20, cast(20u8).unwrap());
11541154
assert_eq!(_20, cast(20u16).unwrap());
11551155
assert_eq!(_20, cast(20u32).unwrap());
@@ -1763,7 +1763,7 @@ mod bench {
17631763

17641764
#[bench]
17651765
fn bench_pow_function(b: &mut Bencher) {
1766-
let v = (0..1024u).collect::<Vec<_>>();
1767-
b.iter(|| {v.iter().fold(0u, |old, new| old.pow(*new));});
1766+
let v = (0..1024).collect::<Vec<_>>();
1767+
b.iter(|| {v.iter().fold(0, |old, new| old.pow(*new));});
17681768
}
17691769
}

src/libstd/num/strconv.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ pub fn float_to_str_bytes_common<T: Float>(
262262

263263
// If limited digits, calculate one digit more for rounding.
264264
let (limit_digits, digit_count, exact) = match digits {
265-
DigAll => (false, 0u, false),
265+
DigAll => (false, 0, false),
266266
DigMax(count) => (true, count+1, false),
267267
DigExact(count) => (true, count+1, true)
268268
};
@@ -289,7 +289,7 @@ pub fn float_to_str_bytes_common<T: Float>(
289289
deccum = num.fract();
290290
if deccum != _0 || (limit_digits && exact && digit_count > 0) {
291291
buf.push(b'.');
292-
let mut dig = 0u;
292+
let mut dig = 0;
293293

294294
// calculate new digits while
295295
// - there is no limit and there are digits left
@@ -314,7 +314,7 @@ pub fn float_to_str_bytes_common<T: Float>(
314314

315315
// Decrease the deccumulator one fractional digit at a time
316316
deccum = deccum.fract();
317-
dig += 1u;
317+
dig += 1;
318318
}
319319

320320
// If digits are limited, and that limit has been reached,

src/libstd/num/uint_macros.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ mod tests {
2525

2626
#[test]
2727
pub fn test_from_str() {
28-
assert_eq!(from_str::<$T>("0"), Some(0u as $T));
29-
assert_eq!(from_str::<$T>("3"), Some(3u as $T));
30-
assert_eq!(from_str::<$T>("10"), Some(10u as $T));
28+
assert_eq!(from_str::<$T>("0"), Some(0 as $T));
29+
assert_eq!(from_str::<$T>("3"), Some(3 as $T));
30+
assert_eq!(from_str::<$T>("10"), Some(10 as $T));
3131
assert_eq!(from_str::<u32>("123456789"), Some(123456789 as u32));
32-
assert_eq!(from_str::<$T>("00100"), Some(100u as $T));
32+
assert_eq!(from_str::<$T>("00100"), Some(100 as $T));
3333

3434
assert_eq!(from_str::<$T>(""), None);
3535
assert_eq!(from_str::<$T>(" "), None);
@@ -38,12 +38,12 @@ mod tests {
3838

3939
#[test]
4040
pub fn test_parse_bytes() {
41-
assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123u as $T));
42-
assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9u as $T));
43-
assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83u as $T));
44-
assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291u as u16));
45-
assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535u as u16));
46-
assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35u as $T));
41+
assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123 as $T));
42+
assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9 as $T));
43+
assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83 as $T));
44+
assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291 as u16));
45+
assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535 as u16));
46+
assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35 as $T));
4747

4848
assert_eq!(FromStrRadix::from_str_radix("Z", 10).ok(), None::<$T>);
4949
assert_eq!(FromStrRadix::from_str_radix("_", 2).ok(), None::<$T>);

src/libstd/old_io/extensions.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,21 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where
8585
use mem::transmute;
8686

8787
// LLVM fails to properly optimize this when using shifts instead of the to_le* intrinsics
88-
assert!(size <= 8u);
88+
assert!(size <= 8);
8989
match size {
90-
1u => f(&[n as u8]),
91-
2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }),
92-
4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }),
93-
8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }),
90+
1 => f(&[n as u8]),
91+
2 => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_le()) }),
92+
4 => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_le()) }),
93+
8 => f(unsafe { & transmute::<_, [u8; 8]>(n.to_le()) }),
9494
_ => {
9595

9696
let mut bytes = vec!();
9797
let mut i = size;
9898
let mut n = n;
99-
while i > 0u {
99+
while i > 0 {
100100
bytes.push((n & 255_u64) as u8);
101101
n >>= 8;
102-
i -= 1u;
102+
i -= 1;
103103
}
104104
f(&bytes)
105105
}
@@ -126,19 +126,19 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
126126
use mem::transmute;
127127

128128
// LLVM fails to properly optimize this when using shifts instead of the to_be* intrinsics
129-
assert!(size <= 8u);
129+
assert!(size <= 8);
130130
match size {
131-
1u => f(&[n as u8]),
132-
2u => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }),
133-
4u => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }),
134-
8u => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }),
131+
1 => f(&[n as u8]),
132+
2 => f(unsafe { & transmute::<_, [u8; 2]>((n as u16).to_be()) }),
133+
4 => f(unsafe { & transmute::<_, [u8; 4]>((n as u32).to_be()) }),
134+
8 => f(unsafe { & transmute::<_, [u8; 8]>(n.to_be()) }),
135135
_ => {
136136
let mut bytes = vec!();
137137
let mut i = size;
138-
while i > 0u {
139-
let shift = (i - 1u) * 8u;
138+
while i > 0 {
139+
let shift = (i - 1) * 8;
140140
bytes.push((n >> shift) as u8);
141-
i -= 1u;
141+
i -= 1;
142142
}
143143
f(&bytes)
144144
}
@@ -160,7 +160,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
160160
use ptr::{copy_nonoverlapping_memory};
161161
use slice::SliceExt;
162162

163-
assert!(size <= 8u);
163+
assert!(size <= 8);
164164

165165
if data.len() - start < size {
166166
panic!("index out of bounds");

src/libstd/old_io/mem.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ mod test {
720720
let buf = [5 as u8; 100].to_vec();
721721
{
722722
let mut rdr = MemReader::new(buf);
723-
for _i in 0u..10 {
723+
for _i in 0..10 {
724724
let mut buf = [0 as u8; 10];
725725
rdr.read(&mut buf).unwrap();
726726
assert_eq!(buf, [5; 10]);
@@ -735,7 +735,7 @@ mod test {
735735
let mut buf = [0 as u8; 100];
736736
{
737737
let mut wr = BufWriter::new(&mut buf);
738-
for _i in 0u..10 {
738+
for _i in 0..10 {
739739
wr.write(&[5; 10]).unwrap();
740740
}
741741
}
@@ -749,7 +749,7 @@ mod test {
749749
let buf = [5 as u8; 100];
750750
{
751751
let mut rdr = BufReader::new(&buf);
752-
for _i in 0u..10 {
752+
for _i in 0..10 {
753753
let mut buf = [0 as u8; 10];
754754
rdr.read(&mut buf).unwrap();
755755
assert_eq!(buf, [5; 10]);

0 commit comments

Comments
 (0)