From b3c9fd891eaff9dace0999767f6a5026b3440959 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 25 Jun 2014 13:12:43 +0200 Subject: [PATCH 1/2] Add type suffixes where necessary --- cat/cat.rs | 4 ++-- cksum/cksum.rs | 2 +- echo/echo.rs | 2 +- hashsum/hashsum.rs | 4 ++-- nl/nl.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cat/cat.rs b/cat/cat.rs index cb3cccae8..28304f183 100644 --- a/cat/cat.rs +++ b/cat/cat.rs @@ -177,7 +177,7 @@ fn write_bytes(files: Vec, number: NumberingMode, squeeze_blank: bool, }; // Flush all 1024 iterations. - let mut flush_counter = range(0, 1024); + let mut flush_counter = range(0u, 1024); let mut in_buf = [0, .. 1024 * 32]; let mut out_buf = [0, .. 1024 * 64]; @@ -191,7 +191,7 @@ fn write_bytes(files: Vec, number: NumberingMode, squeeze_blank: bool, for &byte in in_buf.slice_to(n).iter() { if flush_counter.next().is_none() { writer.possibly_flush(); - flush_counter = range(0, 1024); + flush_counter = range(0u, 1024); } if byte == '\n' as u8 { if !at_line_start || !squeeze_blank { diff --git a/cksum/cksum.rs b/cksum/cksum.rs index 0044e19c5..5e25cf4a8 100644 --- a/cksum/cksum.rs +++ b/cksum/cksum.rs @@ -25,7 +25,7 @@ static VERSION : &'static str = "1.0.0"; fn crc_update(mut crc: u32, input: u8) -> u32 { crc ^= input as u32 << 24; - for _ in range(0, 8) { + for _ in range(0u, 8) { if crc & 0x80000000 != 0 { crc <<= 1; crc ^= 0x04c11db7; diff --git a/echo/echo.rs b/echo/echo.rs index 1ba00d0a1..f517b8fc1 100644 --- a/echo/echo.rs +++ b/echo/echo.rs @@ -60,7 +60,7 @@ fn convert_str(string: &str, index: uint, base: uint) -> (char, uint) { }; let mut bytes = vec!(); - for offset in range(0, max_digits) { + for offset in range(0u, max_digits) { if string.len() <= index + offset as uint { break; } diff --git a/hashsum/hashsum.rs b/hashsum/hashsum.rs index 01da1869c..eeda041f0 100644 --- a/hashsum/hashsum.rs +++ b/hashsum/hashsum.rs @@ -162,8 +162,8 @@ fn usage(program: &str, binary_name: &str, opts: &[getopts::OptGroup]) { } fn hashsum(algoname: &str, mut digest: Box, files: Vec, binary: bool, check: bool, tag: bool, status: bool, quiet: bool, strict: bool, warn: bool) -> Result<(), int> { - let mut bad_format = 0; - let mut failed = 0; + let mut bad_format = 0u; + let mut failed = 0u; let binary_marker = if binary { "*" } else { diff --git a/nl/nl.rs b/nl/nl.rs index 00eeb1604..468719d2b 100644 --- a/nl/nl.rs +++ b/nl/nl.rs @@ -170,7 +170,7 @@ fn nl (reader: &mut BufferedReader, settings: &Settings) { let line_no_width_initial = line_no_width; // Stores the smallest integer with one more digit than line_no, so that // when line_no >= line_no_threshold, we need to use one more digit. - let mut line_no_threshold = std::num::pow(10, line_no_width) as u64; + let mut line_no_threshold = std::num::pow(10u64, line_no_width); let mut empty_line_count: u64 = 0; let fill_char = match settings.number_format { RightZero => '0', @@ -232,7 +232,7 @@ fn nl (reader: &mut BufferedReader, settings: &Settings) { if settings.renumber { line_no = settings.starting_line_number; line_no_width = line_no_width_initial; - line_no_threshold = std::num::pow(10, line_no_width) as u64; + line_no_threshold = std::num::pow(10u64, line_no_width); } &settings.header_numbering }, From 765ea7b6eb09fc0cfda4704190081b8d5cf06539 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Wed, 25 Jun 2014 13:12:56 +0200 Subject: [PATCH 2/2] std::bool::to_bit was removed --- nl/nl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nl/nl.rs b/nl/nl.rs index 468719d2b..8f8dafccb 100644 --- a/nl/nl.rs +++ b/nl/nl.rs @@ -204,7 +204,7 @@ fn nl (reader: &mut BufferedReader, settings: &Settings) { // a header) or the current char does not form part of // a new group, then this line is not a segment indicator. if matched_groups >= 3 - || settings.section_delimiter[std::bool::to_bit::(odd)] != c { + || settings.section_delimiter[if odd { 1 } else { 0 }] != c { matched_groups = 0; break; }