Skip to content

More deprecating of i/u suffixes #21613

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
Feb 3, 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
4 changes: 2 additions & 2 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> {
.collect();

match strs.len() {
1u => (strs.pop().unwrap(), "".to_string()),
2u => {
1 => (strs.pop().unwrap(), "".to_string()),
2 => {
let end = strs.pop().unwrap();
(strs.pop().unwrap(), end)
}
Expand Down
18 changes: 9 additions & 9 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
let s = File::open(&filepath).read_to_end().unwrap();
String::from_utf8(s).unwrap()
}
None => { srcs[srcs.len() - 2u].clone() }
None => { srcs[srcs.len() - 2].clone() }
};
let mut actual = srcs[srcs.len() - 1u].clone();
let mut actual = srcs[srcs.len() - 1].clone();

if props.pp_exact.is_some() {
// Now we have to care about line endings
Expand Down Expand Up @@ -842,7 +842,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
}).collect();
// check if each line in props.check_lines appears in the
// output (in order)
let mut i = 0u;
let mut i = 0;
for line in debugger_run_result.stdout.lines() {
let mut rest = line.trim();
let mut first = true;
Expand All @@ -869,7 +869,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
first = false;
}
if !failed && rest.len() == 0 {
i += 1u;
i += 1;
}
if i == num_check_lines {
// all lines checked
Expand All @@ -892,13 +892,13 @@ fn check_error_patterns(props: &TestProps,
fatal(format!("no error pattern specified in {:?}",
testfile.display()).as_slice());
}
let mut next_err_idx = 0u;
let mut next_err_idx = 0;
let mut next_err_pat = &props.error_patterns[next_err_idx];
let mut done = false;
for line in output_to_check.lines() {
if line.contains(next_err_pat.as_slice()) {
debug!("found error pattern {}", next_err_pat);
next_err_idx += 1u;
next_err_idx += 1;
if next_err_idx == props.error_patterns.len() {
debug!("found all error patterns");
done = true;
Expand All @@ -910,7 +910,7 @@ fn check_error_patterns(props: &TestProps,
if done { return; }

let missing_patterns = &props.error_patterns[next_err_idx..];
if missing_patterns.len() == 1u {
if missing_patterns.len() == 1 {
fatal_proc_rec(format!("error pattern '{}' not found!",
missing_patterns[0]).as_slice(),
proc_res);
Expand Down Expand Up @@ -1025,7 +1025,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
}

fn is_compiler_error_or_warning(line: &str) -> bool {
let mut i = 0u;
let mut i = 0;
return
scan_until_char(line, ':', &mut i) &&
scan_char(line, ':', &mut i) &&
Expand Down Expand Up @@ -1084,7 +1084,7 @@ fn scan_integer(haystack: &str, idx: &mut uint) -> bool {

fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
let mut haystack_i = *idx;
let mut needle_i = 0u;
let mut needle_i = 0;
while needle_i < needle.len() {
if haystack_i >= haystack.len() {
return false;
Expand Down
16 changes: 8 additions & 8 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct Arena {
impl Arena {
/// Allocates a new Arena with 32 bytes preallocated.
pub fn new() -> Arena {
Arena::new_with_size(32u)
Arena::new_with_size(32)
}

/// Allocates a new Arena with `initial_size` bytes preallocated.
Expand All @@ -117,7 +117,7 @@ impl Arena {
fn chunk(size: uint, is_copy: bool) -> Chunk {
Chunk {
data: Rc::new(RefCell::new(Vec::with_capacity(size))),
fill: Cell::new(0u),
fill: Cell::new(0),
is_copy: Cell::new(is_copy),
}
}
Expand Down Expand Up @@ -193,7 +193,7 @@ impl Arena {
self.chunks.borrow_mut().push(self.copy_head.borrow().clone());

*self.copy_head.borrow_mut() =
chunk((new_min_chunk_size + 1u).next_power_of_two(), true);
chunk((new_min_chunk_size + 1).next_power_of_two(), true);

return self.alloc_copy_inner(n_bytes, align);
}
Expand Down Expand Up @@ -234,7 +234,7 @@ impl Arena {
self.chunks.borrow_mut().push(self.head.borrow().clone());

*self.head.borrow_mut() =
chunk((new_min_chunk_size + 1u).next_power_of_two(), false);
chunk((new_min_chunk_size + 1).next_power_of_two(), false);

return self.alloc_noncopy_inner(n_bytes, align);
}
Expand Down Expand Up @@ -308,7 +308,7 @@ impl Arena {
#[test]
fn test_arena_destructors() {
let arena = Arena::new();
for i in 0u..10 {
for i in 0..10 {
// Arena allocate something with drop glue to make sure it
// doesn't leak.
arena.alloc(|| Rc::new(i));
Expand Down Expand Up @@ -337,7 +337,7 @@ fn test_arena_alloc_nested() {
fn test_arena_destructors_fail() {
let arena = Arena::new();
// Put some stuff in the arena.
for i in 0u..10 {
for i in 0..10 {
// Arena allocate something with drop glue to make sure it
// doesn't leak.
arena.alloc(|| { Rc::new(i) });
Expand Down Expand Up @@ -527,7 +527,7 @@ mod tests {
#[test]
pub fn test_copy() {
let arena = TypedArena::new();
for _ in 0u..100000 {
for _ in 0..100000 {
arena.alloc(Point {
x: 1,
y: 2,
Expand Down Expand Up @@ -582,7 +582,7 @@ mod tests {
#[test]
pub fn test_noncopy() {
let arena = TypedArena::new();
for _ in 0u..100000 {
for _ in 0..100000 {
arena.alloc(Noncopy {
string: "hello world".to_string(),
array: vec!( 1, 2, 3, 4, 5 ),
Expand Down
8 changes: 4 additions & 4 deletions src/libflate/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ mod tests {
fn test_flate_round_trip() {
let mut r = rand::thread_rng();
let mut words = vec!();
for _ in 0u..20 {
let range = r.gen_range(1u, 10);
for _ in 0..20 {
let range = r.gen_range(1, 10);
let v = r.gen_iter::<u8>().take(range).collect::<Vec<u8>>();
words.push(v);
}
for _ in 0u..20 {
for _ in 0..20 {
let mut input = vec![];
for _ in 0u..2000 {
for _ in 0..2000 {
input.push_all(r.choose(words.as_slice()).unwrap().as_slice());
}
debug!("de/inflate of {} bytes of random word-sequences",
Expand Down
6 changes: 3 additions & 3 deletions src/libgetopts/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ pub type Result = result::Result<Matches, Fail>;

impl Name {
fn from_str(nm: &str) -> Name {
if nm.len() == 1u {
Short(nm.char_at(0u))
if nm.len() == 1 {
Short(nm.char_at(0))
} else {
Long(nm.to_string())
}
Expand Down Expand Up @@ -694,7 +694,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
}
i += 1;
}
for i in 0u..n_opts {
for i in 0..n_opts {
let n = vals[i].len();
let occ = opts[i].occur;
if occ == Req && n == 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/libgraphviz/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ mod tests {

impl<'a> GraphWalk<'a, Node, &'a Edge> for LabelledGraph {
fn nodes(&'a self) -> Nodes<'a,Node> {
(0u..self.node_labels.len()).collect()
(0..self.node_labels.len()).collect()
}
fn edges(&'a self) -> Edges<'a,&'a Edge> {
self.edges.iter().collect()
Expand Down
2 changes: 1 addition & 1 deletion src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,7 @@ pub mod types {
pub iSecurityScheme: c_int,
pub dwMessageSize: DWORD,
pub dwProviderReserved: DWORD,
pub szProtocol: [u8; (WSAPROTOCOL_LEN as uint) + 1u],
pub szProtocol: [u8; (WSAPROTOCOL_LEN as uint) + 1us],
}

pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;
Expand Down
6 changes: 3 additions & 3 deletions src/liblog/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/// fn main() {
/// log!(log::WARN, "this is a warning {}", "message");
/// log!(log::DEBUG, "this is a debug message");
/// log!(6, "this is a custom logging level: {level}", level=6u);
/// log!(6, "this is a custom logging level: {level}", level=6);
/// }
/// ```
///
Expand Down Expand Up @@ -70,7 +70,7 @@ macro_rules! log {
/// #[macro_use] extern crate log;
///
/// fn main() {
/// let error = 3u;
/// let error = 3;
/// error!("the build has failed with error code: {}", error);
/// }
/// ```
Expand All @@ -95,7 +95,7 @@ macro_rules! error {
/// #[macro_use] extern crate log;
///
/// fn main() {
/// let code = 3u;
/// let code = 3;
/// warn!("you may like to know that a process exited with: {}", code);
/// }
/// ```
Expand Down
6 changes: 3 additions & 3 deletions src/librand/chacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ mod test {
// Store the 17*i-th 32-bit word,
// i.e., the i-th word of the i-th 16-word block
let mut v : Vec<u32> = Vec::new();
for _ in 0u..16 {
for _ in 0..16 {
v.push(ra.next_u32());
for _ in 0u..16 {
for _ in 0..16 {
ra.next_u32();
}
}
Expand All @@ -287,7 +287,7 @@ mod test {
let seed : &[_] = &[0u32; 8];
let mut rng: ChaChaRng = SeedableRng::from_seed(seed);
let mut clone = rng.clone();
for _ in 0u..16 {
for _ in 0..16 {
assert_eq!(rng.next_u64(), clone.next_u64());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librand/distributions/exponential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ mod test {
fn test_exp() {
let mut exp = Exp::new(10.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
assert!(exp.sample(&mut rng) >= 0.0);
assert!(exp.ind_sample(&mut rng) >= 0.0);
}
Expand Down
10 changes: 5 additions & 5 deletions src/librand/distributions/gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ mod test {
fn test_chi_squared_one() {
let mut chi = ChiSquared::new(1.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
chi.sample(&mut rng);
chi.ind_sample(&mut rng);
}
Expand All @@ -341,7 +341,7 @@ mod test {
fn test_chi_squared_small() {
let mut chi = ChiSquared::new(0.5);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
chi.sample(&mut rng);
chi.ind_sample(&mut rng);
}
Expand All @@ -350,7 +350,7 @@ mod test {
fn test_chi_squared_large() {
let mut chi = ChiSquared::new(30.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
chi.sample(&mut rng);
chi.ind_sample(&mut rng);
}
Expand All @@ -365,7 +365,7 @@ mod test {
fn test_f() {
let mut f = FisherF::new(2.0, 32.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
f.sample(&mut rng);
f.ind_sample(&mut rng);
}
Expand All @@ -375,7 +375,7 @@ mod test {
fn test_t() {
let mut t = StudentT::new(11.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
t.sample(&mut rng);
t.ind_sample(&mut rng);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librand/distributions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub struct Weighted<T> {
/// Weighted { weight: 1, item: 'c' });
/// let wc = WeightedChoice::new(items.as_mut_slice());
/// let mut rng = rand::thread_rng();
/// for _ in 0u..16 {
/// for _ in 0..16 {
/// // on average prints 'a' 4 times, 'b' 8 and 'c' twice.
/// println!("{}", wc.ind_sample(&mut rng));
/// }
Expand All @@ -118,7 +118,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> {
// strictly speaking, this is subsumed by the total weight == 0 case
assert!(!items.is_empty(), "WeightedChoice::new called with no items");

let mut running_total = 0u;
let mut running_total = 0;

// we convert the list from individual weights to cumulative
// weights so we can binary search. This *could* drop elements
Expand Down
4 changes: 2 additions & 2 deletions src/librand/distributions/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ mod tests {
fn test_normal() {
let mut norm = Normal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
norm.sample(&mut rng);
norm.ind_sample(&mut rng);
}
Expand All @@ -185,7 +185,7 @@ mod tests {
fn test_log_normal() {
let mut lnorm = LogNormal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in 0u..1000 {
for _ in 0..1000 {
lnorm.sample(&mut rng);
lnorm.ind_sample(&mut rng);
}
Expand Down
8 changes: 4 additions & 4 deletions src/librand/distributions/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ use distributions::{Sample, IndependentSample};
/// use std::rand::distributions::{IndependentSample, Range};
///
/// fn main() {
/// let between = Range::new(10u, 10000u);
/// let between = Range::new(10, 10000);
/// let mut rng = std::rand::thread_rng();
/// let mut sum = 0;
/// for _ in 0u..1000 {
/// for _ in 0..1000 {
/// sum += between.ind_sample(&mut rng);
/// }
/// println!("{}", sum);
Expand Down Expand Up @@ -190,7 +190,7 @@ mod tests {
(Int::min_value(), Int::max_value())];
for &(low, high) in v.iter() {
let mut sampler: Range<$ty> = Range::new(low, high);
for _ in 0u..1000 {
for _ in 0..1000 {
let v = sampler.sample(&mut rng);
assert!(low <= v && v < high);
let v = sampler.ind_sample(&mut rng);
Expand All @@ -216,7 +216,7 @@ mod tests {
(-1e35, 1e35)];
for &(low, high) in v.iter() {
let mut sampler: Range<$ty> = Range::new(low, high);
for _ in 0u..1000 {
for _ in 0..1000 {
let v = sampler.sample(&mut rng);
assert!(low <= v && v < high);
let v = sampler.ind_sample(&mut rng);
Expand Down
Loading