Skip to content

Commit f67e747

Browse files
author
Alfie John
committed
Moving away from deprecated i/u suffixes in libcore
1 parent bb7cc4e commit f67e747

19 files changed

+128
-128
lines changed

Diff for: src/libcore/atomic.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ impl AtomicUsize {
589589
/// ```
590590
/// use std::sync::atomic::AtomicUsize;
591591
///
592-
/// let atomic_forty_two = AtomicUsize::new(42u);
592+
/// let atomic_forty_two = AtomicUsize::new(42);
593593
/// ```
594594
#[inline]
595595
pub fn new(v: usize) -> AtomicUsize {
@@ -765,7 +765,7 @@ impl<T> AtomicPtr<T> {
765765
/// ```
766766
/// use std::sync::atomic::AtomicPtr;
767767
///
768-
/// let ptr = &mut 5i;
768+
/// let ptr = &mut 5;
769769
/// let atomic_ptr = AtomicPtr::new(ptr);
770770
/// ```
771771
#[inline]
@@ -787,7 +787,7 @@ impl<T> AtomicPtr<T> {
787787
/// ```
788788
/// use std::sync::atomic::{AtomicPtr, Ordering};
789789
///
790-
/// let ptr = &mut 5i;
790+
/// let ptr = &mut 5;
791791
/// let some_ptr = AtomicPtr::new(ptr);
792792
///
793793
/// let value = some_ptr.load(Ordering::Relaxed);
@@ -809,10 +809,10 @@ impl<T> AtomicPtr<T> {
809809
/// ```
810810
/// use std::sync::atomic::{AtomicPtr, Ordering};
811811
///
812-
/// let ptr = &mut 5i;
812+
/// let ptr = &mut 5;
813813
/// let some_ptr = AtomicPtr::new(ptr);
814814
///
815-
/// let other_ptr = &mut 10i;
815+
/// let other_ptr = &mut 10;
816816
///
817817
/// some_ptr.store(other_ptr, Ordering::Relaxed);
818818
/// ```
@@ -835,10 +835,10 @@ impl<T> AtomicPtr<T> {
835835
/// ```
836836
/// use std::sync::atomic::{AtomicPtr, Ordering};
837837
///
838-
/// let ptr = &mut 5i;
838+
/// let ptr = &mut 5;
839839
/// let some_ptr = AtomicPtr::new(ptr);
840840
///
841-
/// let other_ptr = &mut 10i;
841+
/// let other_ptr = &mut 10;
842842
///
843843
/// let value = some_ptr.swap(other_ptr, Ordering::Relaxed);
844844
/// ```
@@ -860,11 +860,11 @@ impl<T> AtomicPtr<T> {
860860
/// ```
861861
/// use std::sync::atomic::{AtomicPtr, Ordering};
862862
///
863-
/// let ptr = &mut 5i;
863+
/// let ptr = &mut 5;
864864
/// let some_ptr = AtomicPtr::new(ptr);
865865
///
866-
/// let other_ptr = &mut 10i;
867-
/// let another_ptr = &mut 10i;
866+
/// let other_ptr = &mut 10;
867+
/// let another_ptr = &mut 10;
868868
///
869869
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
870870
/// ```

Diff for: src/libcore/cell.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
//!
6868
//! fn main() {
6969
//! let shared_map: Rc<RefCell<_>> = Rc::new(RefCell::new(HashMap::new()));
70-
//! shared_map.borrow_mut().insert("africa", 92388i);
71-
//! shared_map.borrow_mut().insert("kyoto", 11837i);
72-
//! shared_map.borrow_mut().insert("piccadilly", 11826i);
73-
//! shared_map.borrow_mut().insert("marbles", 38i);
70+
//! shared_map.borrow_mut().insert("africa", 92388);
71+
//! shared_map.borrow_mut().insert("kyoto", 11837);
72+
//! shared_map.borrow_mut().insert("piccadilly", 11826);
73+
//! shared_map.borrow_mut().insert("marbles", 38);
7474
//! }
7575
//! ```
7676
//!

Diff for: src/libcore/char.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
102102
if num < 10 {
103103
Some(transmute(('0' as uint + num) as u32))
104104
} else {
105-
Some(transmute(('a' as uint + num - 10u) as u32))
105+
Some(transmute(('a' as uint + num - 10) as u32))
106106
}
107107
}
108108
} else {
@@ -208,8 +208,8 @@ impl CharExt for char {
208208
}
209209
let val = match self {
210210
'0' ... '9' => self as uint - ('0' as uint),
211-
'a' ... 'z' => self as uint + 10u - ('a' as uint),
212-
'A' ... 'Z' => self as uint + 10u - ('A' as uint),
211+
'a' ... 'z' => self as uint + 10 - ('a' as uint),
212+
'A' ... 'Z' => self as uint + 10 - ('A' as uint),
213213
_ => return None,
214214
};
215215
if val < radix { Some(val) }
@@ -241,10 +241,10 @@ impl CharExt for char {
241241
fn len_utf8(self) -> uint {
242242
let code = self as u32;
243243
match () {
244-
_ if code < MAX_ONE_B => 1u,
245-
_ if code < MAX_TWO_B => 2u,
246-
_ if code < MAX_THREE_B => 3u,
247-
_ => 4u,
244+
_ if code < MAX_ONE_B => 1,
245+
_ if code < MAX_TWO_B => 2,
246+
_ if code < MAX_THREE_B => 3,
247+
_ => 4,
248248
}
249249
}
250250

@@ -359,7 +359,7 @@ impl Iterator for EscapeUnicode {
359359
Some('u')
360360
}
361361
EscapeUnicodeState::LeftBrace => {
362-
let mut n = 0u;
362+
let mut n = 0;
363363
while (self.c as u32) >> (4 * (n + 1)) != 0 {
364364
n += 1;
365365
}

Diff for: src/libcore/cmp.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ pub trait Eq: PartialEq<Self> {
110110
pub enum Ordering {
111111
/// An ordering where a compared value is less [than another].
112112
#[stable]
113-
Less = -1i,
113+
Less = -1,
114114
/// An ordering where a compared value is equal [to another].
115115
#[stable]
116-
Equal = 0i,
116+
Equal = 0,
117117
/// An ordering where a compared value is greater [than another].
118118
#[stable]
119-
Greater = 1i,
119+
Greater = 1,
120120
}
121121

122122
impl Ordering {
@@ -132,12 +132,12 @@ impl Ordering {
132132
/// assert_eq!(Equal.reverse(), Equal);
133133
/// assert_eq!(Greater.reverse(), Less);
134134
///
135-
/// let mut data: &mut [_] = &mut [2u, 10, 5, 8];
135+
/// let mut data: &mut [_] = &mut [2, 10, 5, 8];
136136
///
137137
/// // sort the array from largest to smallest.
138138
/// data.sort_by(|a, b| a.cmp(b).reverse());
139139
///
140-
/// let b: &mut [_] = &mut [10u, 8, 5, 2];
140+
/// let b: &mut [_] = &mut [10, 8, 5, 2];
141141
/// assert!(data == b);
142142
/// ```
143143
#[inline]
@@ -174,9 +174,9 @@ pub trait Ord: Eq + PartialOrd<Self> {
174174
/// ```
175175
/// use std::cmp::Ordering::{Less, Equal, Greater};
176176
///
177-
/// assert_eq!( 5u.cmp(&10), Less); // because 5 < 10
178-
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
179-
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
177+
/// assert_eq!( 5.cmp(&10), Less); // because 5 < 10
178+
/// assert_eq!(10.cmp(&5), Greater); // because 10 > 5
179+
/// assert_eq!( 5.cmp(&5), Equal); // because 5 == 5
180180
/// ```
181181
#[stable]
182182
fn cmp(&self, other: &Self) -> Ordering;

Diff for: src/libcore/default.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,17 @@ default_impl! { (), () }
150150
default_impl! { bool, false }
151151
default_impl! { char, '\x00' }
152152

153-
default_impl! { uint, 0u }
154-
default_impl! { u8, 0u8 }
155-
default_impl! { u16, 0u16 }
156-
default_impl! { u32, 0u32 }
157-
default_impl! { u64, 0u64 }
153+
default_impl! { uint, 0 }
154+
default_impl! { u8, 0 }
155+
default_impl! { u16, 0 }
156+
default_impl! { u32, 0 }
157+
default_impl! { u64, 0 }
158158

159-
default_impl! { int, 0i }
160-
default_impl! { i8, 0i8 }
161-
default_impl! { i16, 0i16 }
162-
default_impl! { i32, 0i32 }
163-
default_impl! { i64, 0i64 }
159+
default_impl! { int, 0 }
160+
default_impl! { i8, 0 }
161+
default_impl! { i16, 0 }
162+
default_impl! { i32, 0 }
163+
default_impl! { i64, 0 }
164164

165165
default_impl! { f32, 0.0f32 }
166166
default_impl! { f64, 0.0f64 }

Diff for: src/libcore/fmt/float.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub enum SignFormat {
5353
SignNeg
5454
}
5555

56-
static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
56+
static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11;
5757

5858
/// Converts a number to its string representation as a byte vector.
5959
/// This is meant to be a common base implementation for all numeric string
@@ -191,7 +191,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
191191
if deccum != _0 || (limit_digits && exact && digit_count > 0) {
192192
buf[end] = b'.';
193193
end += 1;
194-
let mut dig = 0u;
194+
let mut dig = 0;
195195

196196
// calculate new digits while
197197
// - there is no limit and there are digits left
@@ -218,7 +218,7 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
218218

219219
// Decrease the deccumulator one fractional digit at a time
220220
deccum = deccum.fract();
221-
dig += 1u;
221+
dig += 1;
222222
}
223223

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

Diff for: src/libcore/fmt/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ impl<'a> Formatter<'a> {
560560
};
561561

562562
let (pre_pad, post_pad) = match align {
563-
rt::AlignLeft => (0u, padding),
564-
rt::AlignRight | rt::AlignUnknown => (padding, 0u),
563+
rt::AlignLeft => (0, padding),
564+
rt::AlignRight | rt::AlignUnknown => (padding, 0),
565565
rt::AlignCenter => (padding / 2, (padding + 1) / 2),
566566
};
567567

@@ -846,7 +846,7 @@ macro_rules! tuple {
846846
fn fmt(&self, f: &mut Formatter) -> Result {
847847
try!(write!(f, "("));
848848
let ($(ref $name,)*) = *self;
849-
let mut n = 0i;
849+
let mut n = 0;
850850
$(
851851
if n > 0 {
852852
try!(write!(f, ", "));

Diff for: src/libcore/fmt/num.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub struct RadixFmt<T, R>(T, R);
145145
///
146146
/// ```
147147
/// use std::fmt::radix;
148-
/// assert_eq!(format!("{}", radix(55i, 36)), "1j".to_string());
148+
/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string());
149149
/// ```
150150
#[unstable = "may be renamed or move to a different module"]
151151
pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {

Diff for: src/libcore/hash/sip.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl Writer for SipHasher {
122122
let length = msg.len();
123123
self.length += length;
124124

125-
let mut needed = 0u;
125+
let mut needed = 0;
126126

127127
if self.ntail != 0 {
128128
needed = 8 - self.ntail;

Diff for: src/libcore/iter.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
//! translated to the `loop` below.
3434
//!
3535
//! ```
36-
//! let values = vec![1i, 2, 3];
36+
//! let values = vec![1, 2, 3];
3737
//!
3838
//! // "Syntactical sugar" taking advantage of an iterator
3939
//! for &x in values.iter() {
@@ -615,7 +615,7 @@ pub trait IteratorExt: Iterator + Sized {
615615
/// # Examples
616616
///
617617
/// ```
618-
/// let a = [1i, 2, 3, 4, 5];
618+
/// let a = [1, 2, 3, 4, 5];
619619
/// assert!(a.iter().all(|x| *x > 0));
620620
/// assert!(!a.iter().all(|x| *x > 2));
621621
/// ```
@@ -1141,7 +1141,7 @@ pub trait AdditiveIterator<A> {
11411141
/// ```
11421142
/// use std::iter::AdditiveIterator;
11431143
///
1144-
/// let a = [1i, 2, 3, 4, 5];
1144+
/// let a = [1i32, 2, 3, 4, 5];
11451145
/// let mut it = a.iter().map(|&x| x);
11461146
/// assert!(it.sum() == 15);
11471147
/// ```
@@ -1183,7 +1183,7 @@ pub trait MultiplicativeIterator<A> {
11831183
/// use std::iter::{count, MultiplicativeIterator};
11841184
///
11851185
/// fn factorial(n: usize) -> usize {
1186-
/// count(1u, 1).take_while(|&i| i <= n).product()
1186+
/// count(1, 1).take_while(|&i| i <= n).product()
11871187
/// }
11881188
/// assert!(factorial(0) == 1);
11891189
/// assert!(factorial(1) == 1);
@@ -2526,7 +2526,7 @@ pub struct Range<A> {
25262526
/// ```
25272527
/// let array = [0, 1, 2, 3, 4];
25282528
///
2529-
/// for i in range(0, 5u) {
2529+
/// for i in range(0, 5) {
25302530
/// println!("{}", i);
25312531
/// assert_eq!(i, array[i]);
25322532
/// }

Diff for: src/libcore/macros.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ macro_rules! panic {
4848
/// let x = true;
4949
/// assert!(x, "x wasn't true!");
5050
///
51-
/// let a = 3i; let b = 27i;
51+
/// let a = 3; let b = 27;
5252
/// assert!(a + b == 30, "a = {}, b = {}", a, b);
5353
/// ```
5454
#[macro_export]
@@ -74,8 +74,8 @@ macro_rules! assert {
7474
/// # Example
7575
///
7676
/// ```
77-
/// let a = 3i;
78-
/// let b = 1i + 2i;
77+
/// let a = 3;
78+
/// let b = 1 + 2;
7979
/// assert_eq!(a, b);
8080
/// ```
8181
#[macro_export]
@@ -141,8 +141,8 @@ macro_rules! debug_assert {
141141
/// # Example
142142
///
143143
/// ```
144-
/// let a = 3i;
145-
/// let b = 1i + 2i;
144+
/// let a = 3;
145+
/// let b = 1 + 2;
146146
/// debug_assert_eq!(a, b);
147147
/// ```
148148
#[macro_export]

Diff for: src/libcore/mem.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ pub unsafe fn uninitialized<T>() -> T {
187187
/// ```
188188
/// use std::mem;
189189
///
190-
/// let x = &mut 5i;
191-
/// let y = &mut 42i;
190+
/// let x = &mut 5;
191+
/// let y = &mut 42;
192192
///
193193
/// mem::swap(x, y);
194194
///
195-
/// assert_eq!(42i, *x);
196-
/// assert_eq!(5i, *y);
195+
/// assert_eq!(42, *x);
196+
/// assert_eq!(5, *y);
197197
/// ```
198198
#[inline]
199199
#[stable]
@@ -277,7 +277,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
277277
/// ```
278278
/// use std::cell::RefCell;
279279
///
280-
/// let x = RefCell::new(1i);
280+
/// let x = RefCell::new(1);
281281
///
282282
/// let mut mutable_borrow = x.borrow_mut();
283283
/// *mutable_borrow = 1;
@@ -306,9 +306,9 @@ pub fn drop<T>(_x: T) { }
306306
/// ```
307307
/// use std::mem;
308308
///
309-
/// let one = unsafe { mem::transmute_copy(&1i) };
309+
/// let one = unsafe { mem::transmute_copy(&1) };
310310
///
311-
/// assert_eq!(1u, one);
311+
/// assert_eq!(1, one);
312312
/// ```
313313
#[inline]
314314
#[stable]

Diff for: src/libcore/num/f32.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ use num::FpCategory as Fp;
2323
use option::Option;
2424

2525
#[unstable = "pending integer conventions"]
26-
pub const RADIX: uint = 2u;
26+
pub const RADIX: uint = 2;
2727

2828
#[unstable = "pending integer conventions"]
29-
pub const MANTISSA_DIGITS: uint = 24u;
29+
pub const MANTISSA_DIGITS: uint = 24;
3030
#[unstable = "pending integer conventions"]
31-
pub const DIGITS: uint = 6u;
31+
pub const DIGITS: uint = 6;
3232

3333
#[stable]
3434
pub const EPSILON: f32 = 1.19209290e-07_f32;

0 commit comments

Comments
 (0)