Skip to content

Moving away from deprecated i/u suffixes in libcore #21511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/libcore/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ impl AtomicUsize {
/// ```
/// use std::sync::atomic::AtomicUsize;
///
/// let atomic_forty_two = AtomicUsize::new(42u);
/// let atomic_forty_two = AtomicUsize::new(42);
/// ```
#[inline]
pub fn new(v: usize) -> AtomicUsize {
Expand Down Expand Up @@ -765,7 +765,7 @@ impl<T> AtomicPtr<T> {
/// ```
/// use std::sync::atomic::AtomicPtr;
///
/// let ptr = &mut 5i;
/// let ptr = &mut 5;
/// let atomic_ptr = AtomicPtr::new(ptr);
/// ```
#[inline]
Expand All @@ -787,7 +787,7 @@ impl<T> AtomicPtr<T> {
/// ```
/// use std::sync::atomic::{AtomicPtr, Ordering};
///
/// let ptr = &mut 5i;
/// let ptr = &mut 5;
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let value = some_ptr.load(Ordering::Relaxed);
Expand All @@ -809,10 +809,10 @@ impl<T> AtomicPtr<T> {
/// ```
/// use std::sync::atomic::{AtomicPtr, Ordering};
///
/// let ptr = &mut 5i;
/// let ptr = &mut 5;
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let other_ptr = &mut 10i;
/// let other_ptr = &mut 10;
///
/// some_ptr.store(other_ptr, Ordering::Relaxed);
/// ```
Expand All @@ -835,10 +835,10 @@ impl<T> AtomicPtr<T> {
/// ```
/// use std::sync::atomic::{AtomicPtr, Ordering};
///
/// let ptr = &mut 5i;
/// let ptr = &mut 5;
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let other_ptr = &mut 10i;
/// let other_ptr = &mut 10;
///
/// let value = some_ptr.swap(other_ptr, Ordering::Relaxed);
/// ```
Expand All @@ -860,11 +860,11 @@ impl<T> AtomicPtr<T> {
/// ```
/// use std::sync::atomic::{AtomicPtr, Ordering};
///
/// let ptr = &mut 5i;
/// let ptr = &mut 5;
/// let some_ptr = AtomicPtr::new(ptr);
///
/// let other_ptr = &mut 10i;
/// let another_ptr = &mut 10i;
/// let other_ptr = &mut 10;
/// let another_ptr = &mut 10;
///
/// let value = some_ptr.compare_and_swap(other_ptr, another_ptr, Ordering::Relaxed);
/// ```
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
//!
//! fn main() {
//! let shared_map: Rc<RefCell<_>> = Rc::new(RefCell::new(HashMap::new()));
//! shared_map.borrow_mut().insert("africa", 92388i);
//! shared_map.borrow_mut().insert("kyoto", 11837i);
//! shared_map.borrow_mut().insert("piccadilly", 11826i);
//! shared_map.borrow_mut().insert("marbles", 38i);
//! shared_map.borrow_mut().insert("africa", 92388);
//! shared_map.borrow_mut().insert("kyoto", 11837);
//! shared_map.borrow_mut().insert("piccadilly", 11826);
//! shared_map.borrow_mut().insert("marbles", 38);
//! }
//! ```
//!
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
if num < 10 {
Some(transmute(('0' as uint + num) as u32))
} else {
Some(transmute(('a' as uint + num - 10u) as u32))
Some(transmute(('a' as uint + num - 10) as u32))
}
}
} else {
Expand Down Expand Up @@ -208,8 +208,8 @@ impl CharExt for char {
}
let val = match self {
'0' ... '9' => self as uint - ('0' as uint),
'a' ... 'z' => self as uint + 10u - ('a' as uint),
'A' ... 'Z' => self as uint + 10u - ('A' as uint),
'a' ... 'z' => self as uint + 10 - ('a' as uint),
'A' ... 'Z' => self as uint + 10 - ('A' as uint),
_ => return None,
};
if val < radix { Some(val) }
Expand Down Expand Up @@ -241,10 +241,10 @@ impl CharExt for char {
fn len_utf8(self) -> uint {
let code = self as u32;
match () {
_ if code < MAX_ONE_B => 1u,
_ if code < MAX_TWO_B => 2u,
_ if code < MAX_THREE_B => 3u,
_ => 4u,
_ if code < MAX_ONE_B => 1,
_ if code < MAX_TWO_B => 2,
_ if code < MAX_THREE_B => 3,
_ => 4,
}
}

Expand Down Expand Up @@ -359,7 +359,7 @@ impl Iterator for EscapeUnicode {
Some('u')
}
EscapeUnicodeState::LeftBrace => {
let mut n = 0u;
let mut n = 0;
while (self.c as u32) >> (4 * (n + 1)) != 0 {
n += 1;
}
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ pub trait Eq: PartialEq<Self> {
pub enum Ordering {
/// An ordering where a compared value is less [than another].
#[stable]
Less = -1i,
Less = -1,
/// An ordering where a compared value is equal [to another].
#[stable]
Equal = 0i,
Equal = 0,
/// An ordering where a compared value is greater [than another].
#[stable]
Greater = 1i,
Greater = 1,
}

impl Ordering {
Expand All @@ -132,12 +132,12 @@ impl Ordering {
/// assert_eq!(Equal.reverse(), Equal);
/// assert_eq!(Greater.reverse(), Less);
///
/// let mut data: &mut [_] = &mut [2u, 10, 5, 8];
/// let mut data: &mut [_] = &mut [2, 10, 5, 8];
///
/// // sort the array from largest to smallest.
/// data.sort_by(|a, b| a.cmp(b).reverse());
///
/// let b: &mut [_] = &mut [10u, 8, 5, 2];
/// let b: &mut [_] = &mut [10, 8, 5, 2];
/// assert!(data == b);
/// ```
#[inline]
Expand Down Expand Up @@ -174,9 +174,9 @@ pub trait Ord: Eq + PartialOrd<Self> {
/// ```
/// use std::cmp::Ordering::{Less, Equal, Greater};
///
/// assert_eq!( 5u.cmp(&10), Less); // because 5 < 10
/// assert_eq!(10u.cmp(&5), Greater); // because 10 > 5
/// assert_eq!( 5u.cmp(&5), Equal); // because 5 == 5
/// assert_eq!( 5.cmp(&10), Less); // because 5 < 10
/// assert_eq!(10.cmp(&5), Greater); // because 10 > 5
/// assert_eq!( 5.cmp(&5), Equal); // because 5 == 5
/// ```
#[stable]
fn cmp(&self, other: &Self) -> Ordering;
Expand Down
20 changes: 10 additions & 10 deletions src/libcore/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ default_impl! { (), () }
default_impl! { bool, false }
default_impl! { char, '\x00' }

default_impl! { uint, 0u }
default_impl! { u8, 0u8 }
default_impl! { u16, 0u16 }
default_impl! { u32, 0u32 }
default_impl! { u64, 0u64 }
default_impl! { uint, 0 }
default_impl! { u8, 0 }
default_impl! { u16, 0 }
default_impl! { u32, 0 }
default_impl! { u64, 0 }

default_impl! { int, 0i }
default_impl! { i8, 0i8 }
default_impl! { i16, 0i16 }
default_impl! { i32, 0i32 }
default_impl! { i64, 0i64 }
default_impl! { int, 0 }
default_impl! { i8, 0 }
default_impl! { i16, 0 }
default_impl! { i32, 0 }
default_impl! { i64, 0 }

default_impl! { f32, 0.0f32 }
default_impl! { f64, 0.0f64 }
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub enum SignFormat {
SignNeg
}

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

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

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

// 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,
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ impl<'a> Formatter<'a> {
};

let (pre_pad, post_pad) = match align {
rt::AlignLeft => (0u, padding),
rt::AlignRight | rt::AlignUnknown => (padding, 0u),
rt::AlignLeft => (0, padding),
rt::AlignRight | rt::AlignUnknown => (padding, 0),
rt::AlignCenter => (padding / 2, (padding + 1) / 2),
};

Expand Down Expand Up @@ -846,7 +846,7 @@ macro_rules! tuple {
fn fmt(&self, f: &mut Formatter) -> Result {
try!(write!(f, "("));
let ($(ref $name,)*) = *self;
let mut n = 0i;
let mut n = 0;
$(
if n > 0 {
try!(write!(f, ", "));
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pub struct RadixFmt<T, R>(T, R);
///
/// ```
/// use std::fmt::radix;
/// assert_eq!(format!("{}", radix(55i, 36)), "1j".to_string());
/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string());
/// ```
#[unstable = "may be renamed or move to a different module"]
pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hash/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl Writer for SipHasher {
let length = msg.len();
self.length += length;

let mut needed = 0u;
let mut needed = 0;

if self.ntail != 0 {
needed = 8 - self.ntail;
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
//! translated to the `loop` below.
//!
//! ```
//! let values = vec![1i, 2, 3];
//! let values = vec![1, 2, 3];
//!
//! // "Syntactical sugar" taking advantage of an iterator
//! for &x in values.iter() {
Expand Down Expand Up @@ -615,7 +615,7 @@ pub trait IteratorExt: Iterator + Sized {
/// # Examples
///
/// ```
/// let a = [1i, 2, 3, 4, 5];
/// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().all(|x| *x > 0));
/// assert!(!a.iter().all(|x| *x > 2));
/// ```
Expand Down Expand Up @@ -1141,7 +1141,7 @@ pub trait AdditiveIterator<A> {
/// ```
/// use std::iter::AdditiveIterator;
///
/// let a = [1i, 2, 3, 4, 5];
/// let a = [1i32, 2, 3, 4, 5];
/// let mut it = a.iter().map(|&x| x);
/// assert!(it.sum() == 15);
/// ```
Expand Down Expand Up @@ -1183,7 +1183,7 @@ pub trait MultiplicativeIterator<A> {
/// use std::iter::{count, MultiplicativeIterator};
///
/// fn factorial(n: usize) -> usize {
/// count(1u, 1).take_while(|&i| i <= n).product()
/// count(1, 1).take_while(|&i| i <= n).product()
/// }
/// assert!(factorial(0) == 1);
/// assert!(factorial(1) == 1);
Expand Down Expand Up @@ -2526,7 +2526,7 @@ pub struct Range<A> {
/// ```
/// let array = [0, 1, 2, 3, 4];
///
/// for i in range(0, 5u) {
/// for i in range(0, 5) {
/// println!("{}", i);
/// assert_eq!(i, array[i]);
/// }
Expand Down
10 changes: 5 additions & 5 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ macro_rules! panic {
/// let x = true;
/// assert!(x, "x wasn't true!");
///
/// let a = 3i; let b = 27i;
/// let a = 3; let b = 27;
/// assert!(a + b == 30, "a = {}, b = {}", a, b);
/// ```
#[macro_export]
Expand All @@ -74,8 +74,8 @@ macro_rules! assert {
/// # Example
///
/// ```
/// let a = 3i;
/// let b = 1i + 2i;
/// let a = 3;
/// let b = 1 + 2;
/// assert_eq!(a, b);
/// ```
#[macro_export]
Expand Down Expand Up @@ -141,8 +141,8 @@ macro_rules! debug_assert {
/// # Example
///
/// ```
/// let a = 3i;
/// let b = 1i + 2i;
/// let a = 3;
/// let b = 1 + 2;
/// debug_assert_eq!(a, b);
/// ```
#[macro_export]
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ pub unsafe fn uninitialized<T>() -> T {
/// ```
/// use std::mem;
///
/// let x = &mut 5i;
/// let y = &mut 42i;
/// let x = &mut 5;
/// let y = &mut 42;
///
/// mem::swap(x, y);
///
/// assert_eq!(42i, *x);
/// assert_eq!(5i, *y);
/// assert_eq!(42, *x);
/// assert_eq!(5, *y);
/// ```
#[inline]
#[stable]
Expand Down Expand Up @@ -277,7 +277,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {
/// ```
/// use std::cell::RefCell;
///
/// let x = RefCell::new(1i);
/// let x = RefCell::new(1);
///
/// let mut mutable_borrow = x.borrow_mut();
/// *mutable_borrow = 1;
Expand Down Expand Up @@ -306,9 +306,9 @@ pub fn drop<T>(_x: T) { }
/// ```
/// use std::mem;
///
/// let one = unsafe { mem::transmute_copy(&1i) };
/// let one = unsafe { mem::transmute_copy(&1) };
///
/// assert_eq!(1u, one);
/// assert_eq!(1, one);
/// ```
#[inline]
#[stable]
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use num::FpCategory as Fp;
use option::Option;

#[unstable = "pending integer conventions"]
pub const RADIX: uint = 2u;
pub const RADIX: uint = 2;

#[unstable = "pending integer conventions"]
pub const MANTISSA_DIGITS: uint = 24u;
pub const MANTISSA_DIGITS: uint = 24;
#[unstable = "pending integer conventions"]
pub const DIGITS: uint = 6u;
pub const DIGITS: uint = 6;

#[stable]
pub const EPSILON: f32 = 1.19209290e-07_f32;
Expand Down
Loading