Skip to content

Commit 3586312

Browse files
committed
Removed integer suffixes that cause a harmless fallback to i32.
1 parent 19354d9 commit 3586312

File tree

108 files changed

+302
-302
lines changed

Some content is hidden

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

108 files changed

+302
-302
lines changed

src/liballoc/arc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use heap::deallocate;
9797
/// use std::thread;
9898
///
9999
/// fn main() {
100-
/// let numbers: Vec<_> = (0..100u32).map(|i| i as f32).collect();
100+
/// let numbers: Vec<_> = (0..100).map(|i| i as f32).collect();
101101
/// let shared_numbers = Arc::new(numbers);
102102
///
103103
/// for _ in 0..10 {
@@ -770,7 +770,7 @@ mod tests {
770770

771771
#[test]
772772
fn test_strong_count() {
773-
let a = Arc::new(0u32);
773+
let a = Arc::new(0);
774774
assert!(strong_count(&a) == 1);
775775
let w = a.downgrade();
776776
assert!(strong_count(&a) == 1);
@@ -787,7 +787,7 @@ mod tests {
787787

788788
#[test]
789789
fn test_weak_count() {
790-
let a = Arc::new(0u32);
790+
let a = Arc::new(0);
791791
assert!(strong_count(&a) == 1);
792792
assert!(weak_count(&a) == 0);
793793
let w = a.downgrade();
@@ -813,7 +813,7 @@ mod tests {
813813

814814
#[test]
815815
fn show_arc() {
816-
let a = Arc::new(5u32);
816+
let a = Arc::new(5);
817817
assert_eq!(format!("{:?}", a), "5");
818818
}
819819

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<T : ?Sized> Box<T> {
136136
/// ```
137137
/// use std::boxed;
138138
///
139-
/// let seventeen = Box::new(17u32);
139+
/// let seventeen = Box::new(17);
140140
/// let raw = unsafe { boxed::into_raw(seventeen) };
141141
/// let boxed_again = unsafe { Box::from_raw(raw) };
142142
/// ```

src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ mod tests {
874874

875875
#[test]
876876
fn test_strong_count() {
877-
let a = Rc::new(0u32);
877+
let a = Rc::new(0);
878878
assert!(strong_count(&a) == 1);
879879
let w = a.downgrade();
880880
assert!(strong_count(&a) == 1);
@@ -891,7 +891,7 @@ mod tests {
891891

892892
#[test]
893893
fn test_weak_count() {
894-
let a = Rc::new(0u32);
894+
let a = Rc::new(0);
895895
assert!(strong_count(&a) == 1);
896896
assert!(weak_count(&a) == 0);
897897
let w = a.downgrade();

src/libcollections/slice.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1795,9 +1795,9 @@ mod tests {
17951795
fn test_swap_remove_noncopyable() {
17961796
// Tests that we don't accidentally run destructors twice.
17971797
let mut v = Vec::new();
1798-
v.push(box 0u8);
1799-
v.push(box 0u8);
1800-
v.push(box 0u8);
1798+
v.push(box 0);
1799+
v.push(box 0);
1800+
v.push(box 0);
18011801
let mut _e = v.swap_remove(0);
18021802
assert_eq!(v.len(), 2);
18031803
_e = v.swap_remove(1);
@@ -2116,7 +2116,7 @@ mod tests {
21162116
let mut v: [i32; 0] = [];
21172117
v.sort();
21182118

2119-
let mut v = [0xDEADBEEFu64];
2119+
let mut v = [0xDEADBEEF];
21202120
v.sort();
21212121
assert!(v == [0xDEADBEEF]);
21222122
}
@@ -2170,8 +2170,8 @@ mod tests {
21702170
fn test_connect() {
21712171
let v: [Vec<i32>; 0] = [];
21722172
assert_eq!(v.connect(&0), []);
2173-
assert_eq!([vec![1i], vec![2, 3]].connect(&0), [1, 0, 2, 3]);
2174-
assert_eq!([vec![1i], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]);
2173+
assert_eq!([vec![1], vec![2, 3]].connect(&0), [1, 0, 2, 3]);
2174+
assert_eq!([vec![1], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]);
21752175

21762176
let v: [&[_]; 2] = [&[1], &[2, 3]];
21772177
assert_eq!(v.connect(&0), [1, 0, 2, 3]);
@@ -2658,7 +2658,7 @@ mod tests {
26582658

26592659
#[test]
26602660
fn test_mut_split_at() {
2661-
let mut values = [1u8,2,3,4,5];
2661+
let mut values = [1,2,3,4,5];
26622662
{
26632663
let (left, right) = values.split_at_mut(2);
26642664
{

src/libcollections/vec.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
//! ```
2626
//! let ys: Vec<i32> = vec![];
2727
//!
28-
//! let zs = vec![1i32, 2, 3, 4, 5];
28+
//! let zs = vec![1, 2, 3, 4, 5];
2929
//! ```
3030
//!
3131
//! Push:
3232
//!
3333
//! ```
34-
//! let mut xs = vec![1i32, 2];
34+
//! let mut xs = vec![1, 2];
3535
//!
3636
//! xs.push(3);
3737
//! ```
3838
//!
3939
//! And pop:
4040
//!
4141
//! ```
42-
//! let mut xs = vec![1i32, 2];
42+
//! let mut xs = vec![1, 2];
4343
//!
4444
//! let two = xs.pop();
4545
//! ```
@@ -1975,7 +1975,7 @@ mod tests {
19751975

19761976
#[test]
19771977
fn test_as_vec() {
1978-
let xs = [1u8, 2u8, 3u8];
1978+
let xs = [1, 2, 3];
19791979
assert_eq!(&**as_vec(&xs), xs);
19801980
}
19811981

src/libcore/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
23162316
/// // This iterator will yield up to the last Fibonacci number before the max
23172317
/// // value of `u32`. You can simply change `u32` to `u64` in this line if
23182318
/// // you want higher values than that.
2319-
/// let mut fibonacci = Unfold::new((Some(0u32), Some(1u32)),
2319+
/// let mut fibonacci = Unfold::new((Some(0), Some(1)),
23202320
/// |&mut (ref mut x2, ref mut x1)| {
23212321
/// // Attempt to get the next Fibonacci number
23222322
/// // `x1` will be `None` if previously overflowed.

src/libcore/mem.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn size_of<T>() -> usize {
5454
/// ```
5555
/// use std::mem;
5656
///
57-
/// assert_eq!(4, mem::size_of_val(&5i32));
57+
/// assert_eq!(4, mem::size_of_val(&5));
5858
/// ```
5959
#[inline]
6060
#[stable(feature = "rust1", since = "1.0.0")]
@@ -86,7 +86,7 @@ pub fn min_align_of<T>() -> usize {
8686
/// ```
8787
/// use std::mem;
8888
///
89-
/// assert_eq!(4, mem::min_align_of_val(&5i32));
89+
/// assert_eq!(4, mem::min_align_of_val(&5));
9090
/// ```
9191
#[inline]
9292
#[stable(feature = "rust1", since = "1.0.0")]
@@ -126,7 +126,7 @@ pub fn align_of<T>() -> usize {
126126
/// ```
127127
/// use std::mem;
128128
///
129-
/// assert_eq!(4, mem::align_of_val(&5i32));
129+
/// assert_eq!(4, mem::align_of_val(&5));
130130
/// ```
131131
#[inline]
132132
#[stable(feature = "rust1", since = "1.0.0")]

src/libcoretest/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ fn test_rev() {
477477

478478
#[test]
479479
fn test_cloned() {
480-
let xs = [2u8, 4, 6, 8];
480+
let xs = [2, 4, 6, 8];
481481

482482
let mut it = xs.iter().cloned();
483483
assert_eq!(it.len(), 4);

src/libcoretest/option.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ fn test_collect() {
246246

247247
#[test]
248248
fn test_cloned() {
249-
let val1 = 1u32;
250-
let mut val2 = 2u32;
249+
let val1 = 1;
250+
let mut val2 = 2;
251251
let val1_ref = &val1;
252252
let opt_none: Option<&'static u32> = None;
253253
let opt_ref = Some(&val1);
@@ -259,14 +259,14 @@ fn test_cloned() {
259259
assert_eq!(opt_none.cloned(), None);
260260

261261
// Mutable refs work
262-
assert_eq!(opt_mut_ref.cloned(), Some(2u32));
262+
assert_eq!(opt_mut_ref.cloned(), Some(2));
263263

264264
// Immutable ref works
265265
assert_eq!(opt_ref.clone(), Some(&val1));
266-
assert_eq!(opt_ref.cloned(), Some(1u32));
266+
assert_eq!(opt_ref.cloned(), Some(1));
267267

268268
// Double Immutable ref works
269269
assert_eq!(opt_ref_ref.clone(), Some(&val1_ref));
270270
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val1));
271-
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32));
271+
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1));
272272
}

src/librustc/metadata/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1595,7 +1595,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
15951595
F: FnMut(&mut SeekableMemWriter, &T),
15961596
T: Hash,
15971597
{
1598-
let mut buckets: Vec<Vec<entry<T>>> = (0..256u16).map(|_| Vec::new()).collect();
1598+
let mut buckets: Vec<Vec<entry<T>>> = (0..256).map(|_| Vec::new()).collect();
15991599
for elt in index {
16001600
let mut s = SipHasher::new();
16011601
elt.val.hash(&mut s);

src/librustc_typeck/check/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'tcx> Expectation<'tcx> {
215215
// can lead us astray. Consider for example `if cond
216216
// {22} else {c} as u8` -- if we propagate the
217217
// "castable to u8" constraint to 22, it will pick the
218-
// type 22u8, which is overly constrained (c might not
218+
// type 22, which is overly constrained (c might not
219219
// be a u8). In effect, the problem is that the
220220
// "castable to" expectation is not the tightest thing
221221
// we can say, so we want to drop it in this case.

src/libstd/rand/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl Rng for ThreadRng {
387387
/// use std::rand;
388388
///
389389
/// let x = rand::random();
390-
/// println!("{}", 2u8 * x);
390+
/// println!("{}", 2 * x);
391391
///
392392
/// let y = rand::random::<f64>();
393393
/// println!("{}", y);

src/libstd/sync/mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ use fmt;
8888
/// use std::sync::{Arc, Mutex};
8989
/// use std::thread;
9090
///
91-
/// let lock = Arc::new(Mutex::new(0_u32));
91+
/// let lock = Arc::new(Mutex::new(0));
9292
/// let lock2 = lock.clone();
9393
///
9494
/// let _ = thread::spawn(move || -> () {

src/libstd/sync/task_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a> Drop for Sentinel<'a> {
7171
/// for _ in 0..8 {
7272
/// let tx = tx.clone();
7373
/// pool.execute(move|| {
74-
/// tx.send(1_u32).unwrap();
74+
/// tx.send(1).unwrap();
7575
/// });
7676
/// }
7777
///

src/test/bench/sudoku.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ impl Sudoku {
8181
}
8282

8383
pub fn write(&self, writer: &mut old_io::Writer) {
84-
for row in 0u8..9u8 {
84+
for row in 0..9 {
8585
write!(writer, "{}", self.grid[row as uint][0]);
86-
for col in 1u8..9u8 {
86+
for col in 1..9 {
8787
write!(writer, " {}", self.grid[row as uint][col as uint]);
8888
}
8989
write!(writer, "\n");

src/test/compile-fail/asm-misplaced-option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ pub fn main() {
2121
let mut x: isize = 0;
2222
unsafe {
2323
// extra colon
24-
asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
24+
asm!("mov $1, $0" : "=r"(x) : "r"(5), "0"(x) : : "cc");
2525
//~^ WARNING unrecognized option
2626
}
2727
assert_eq!(x, 5);
2828

2929
unsafe {
3030
// comma in place of a colon
31-
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
31+
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8) : "cc", "volatile");
3232
//~^ WARNING expected a clobber, found an option
3333
}
3434
assert_eq!(x, 13);

src/test/compile-fail/associated-types-path-2.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,30 @@ pub fn f2<T: Foo>(a: T) -> T::A {
2626
}
2727

2828
pub fn f1_int_int() {
29-
f1(2i32, 4i32);
29+
f1(2, 4);
3030
//~^ ERROR mismatched types
3131
//~| expected u32
3232
//~| found i32
3333
}
3434

3535
pub fn f1_int_uint() {
36-
f1(2i32, 4u32);
36+
f1(2, 4);
3737
}
3838

3939
pub fn f1_uint_uint() {
40-
f1(2u32, 4u32);
40+
f1(2, 4);
4141
//~^ ERROR the trait `Foo` is not implemented
4242
//~| ERROR the trait `Foo` is not implemented
4343
}
4444

4545
pub fn f1_uint_int() {
46-
f1(2u32, 4i32);
46+
f1(2, 4);
4747
//~^ ERROR the trait `Foo` is not implemented
4848
//~| ERROR the trait `Foo` is not implemented
4949
}
5050

5151
pub fn f2_int() {
52-
let _: i32 = f2(2i32);
52+
let _: i32 = f2(2);
5353
//~^ ERROR mismatched types
5454
//~| expected `i32`
5555
//~| found `u32`

src/test/compile-fail/cast-to-nil.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
// except according to those terms.
1010

1111
// error-pattern: non-scalar cast: `u32` as `()`
12-
fn main() { let u = 0u32 as (); }
12+
fn main() { let u = 0 as (); }

src/test/compile-fail/method-ambig-two-traits-cross-crate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ trait me2 {
1818
fn me(&self) -> usize;
1919
}
2020
impl me2 for usize { fn me(&self) -> usize { *self } }
21-
fn main() { 1_usize.me(); } //~ ERROR E0034
21+
fn main() { 1.me(); } //~ ERROR E0034
2222

src/test/compile-fail/method-ambig-two-traits-with-default-method.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ impl Foo for usize {}
1919
impl Bar for usize {}
2020

2121
fn main() {
22-
1_usize.method(); //~ ERROR E0034
22+
1.method(); //~ ERROR E0034
2323
}

src/test/debuginfo/gdb-pretty-struct-and-enums.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ fn main() {
125125
the_fourth_field: "I'm so pretty, oh so pretty..."
126126
};
127127

128-
let tuple = ( true, 103u32, "blub" );
128+
let tuple = ( true, 103, "blub" );
129129

130130
let tuple_struct = TupleStruct(-104.5, 105);
131131

@@ -139,7 +139,7 @@ fn main() {
139139
let mixed_enum_tuple_var = MixedEnumTupleVar(106, 107, false);
140140
let mixed_enum_struct_var = MixedEnumStructVar { field1: 108.5, field2: 109 };
141141

142-
let some = Some(110_usize);
142+
let some = Some(110);
143143
let none: Option<int> = None;
144144
let some_fat = Some("abc");
145145
let none_fat: Option<&'static str> = None;

src/test/debuginfo/generic-function.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn dup_tup<T0: Clone, T1: Clone>(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) {
8686
fn main() {
8787

8888
let _ = dup_tup(&1, &2.5f64);
89-
let _ = dup_tup(&3.5f64, &4_u16);
89+
let _ = dup_tup(&3.5f64, &4);
9090
let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 });
9191
}
9292

src/test/debuginfo/generic-method-on-generic-struct.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,13 @@ impl<T1> Struct<T1> {
138138
}
139139

140140
fn main() {
141-
let stack = Struct { x: (8888_u32, -8888_i32) };
142-
let _ = stack.self_by_ref(-1, 2_u16);
143-
let _ = stack.self_by_val(-3, -4_i16);
141+
let stack = Struct { x: (8888, -8888) };
142+
let _ = stack.self_by_ref(-1, 2);
143+
let _ = stack.self_by_val(-3, -4);
144144

145145
let owned = box Struct { x: 1234.5f64 };
146-
let _ = owned.self_by_ref(-5, -6_i32);
147-
let _ = owned.self_by_val(-7, -8_i64);
146+
let _ = owned.self_by_ref(-5, -6);
147+
let _ = owned.self_by_val(-7, -8);
148148
let _ = owned.self_owned(-9, -10.5_f32);
149149
}
150150

0 commit comments

Comments
 (0)