Skip to content
Closed
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
6 changes: 3 additions & 3 deletions src/mktemp/mktemp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ pub fn dry_exec(mut tmpdir: PathBuf, prefix: &str, rand: usize, suffix: &str) ->
rand::thread_rng().fill(bytes);
for byte in bytes.iter_mut() {
*byte = match *byte % 62 {
v @ 0...9 => (v + '0' as u8),
v @ 10...35 => (v - 10 + 'a' as u8),
v @ 36...61 => (v - 36 + 'A' as u8),
v @ 0..=9 => (v + '0' as u8),
v @ 10..=35 => (v - 10 + 'a' as u8),
v @ 36..=61 => (v - 36 + 'A' as u8),
_ => unreachable!(),
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/numfmt/numfmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn parse_suffix(s: String) -> Result<(f64, Option<Suffix>)> {
Some('E') => Ok(Some((RawSuffix::E, with_i))),
Some('Z') => Ok(Some((RawSuffix::Z, with_i))),
Some('Y') => Ok(Some((RawSuffix::Y, with_i))),
Some('0'...'9') => Ok(None),
Some('0'..='9') => Ok(None),
_ => Err("Failed to parse suffix"),
}?;

Expand Down Expand Up @@ -315,10 +315,10 @@ pub fn uumain(args: Vec<String>) -> i32 {
let matches = opts.parse(&args[1..]).unwrap();
if matches.opt_present("help") {
println!("{} {}", NAME, VERSION);
println!("");
println!();
println!("Usage:");
println!(" {0} [STRING]... [OPTION]...", NAME);
println!("");
println!();
print!(
"{}",
opts.usage("Convert numbers from/to human-readable strings")
Expand Down
14 changes: 7 additions & 7 deletions src/printf/tokenize/num_format/formatters/base_conv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ impl RadixDef for RadixTen {
}
fn from_char(&self, c: char) -> Option<u8> {
match c {
'0'...'9' => Some(c as u8 - ZERO_ASC),
'0'..='9' => Some(c as u8 - ZERO_ASC),
_ => None,
}
}
fn from_u8(&self, u: u8) -> Option<char> {
match u {
0...9 => Some((ZERO_ASC + u) as char),
0..=9 => Some((ZERO_ASC + u) as char),
_ => None,
}
}
Expand All @@ -316,16 +316,16 @@ impl RadixDef for RadixHex {
}
fn from_char(&self, c: char) -> Option<u8> {
match c {
'0'...'9' => Some(c as u8 - ZERO_ASC),
'A'...'F' => Some(c as u8 + 10 - UPPER_A_ASC),
'a'...'f' => Some(c as u8 + 10 - LOWER_A_ASC),
'0'..='9' => Some(c as u8 - ZERO_ASC),
'A'..='F' => Some(c as u8 + 10 - UPPER_A_ASC),
'a'..='f' => Some(c as u8 + 10 - LOWER_A_ASC),
_ => None,
}
}
fn from_u8(&self, u: u8) -> Option<char> {
match u {
0...9 => Some((ZERO_ASC + u) as char),
10...15 => Some((UPPER_A_ASC + (u - 10)) as char),
0..=9 => Some((ZERO_ASC + u) as char),
10..=15 => Some((UPPER_A_ASC + (u - 10)) as char),
_ => None,
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/printf/tokenize/num_format/formatters/float_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ impl FloatAnalysis {
let mut pos_before_first_nonzero_after_decimal: Option<usize> = None;
while let Some(c) = str_it.next() {
match c {
e @ '0'...'9' | e @ 'A'...'F' | e @ 'a'...'f' => {
e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => {
if !hex_input {
match e {
'0'...'9' => {}
'0'..='9' => {}
_ => {
warn_incomplete_conv(str_in);
break;
Expand Down Expand Up @@ -188,7 +188,7 @@ fn round_terminal_digit(
.expect("");
}
match digit_at_pos {
'5'...'9' => {
'5'..='9' => {
let (new_after_dec, finished_in_dec) = _round_str_from(&after_dec, position);
if finished_in_dec {
return (before_dec, new_after_dec);
Expand Down
4 changes: 2 additions & 2 deletions src/printf/tokenize/num_format/formatters/intf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl Intf {
let c_opt = str_it.next();
if let Some(c) = c_opt {
match c {
'0'...'9' | 'a'...'f' | 'A'...'F' => {
'0'..='9' | 'a'..='f' | 'A'..='F' => {
if ret.len_digits == 0 && c == '0' {
ret.is_zero = true;
} else if ret.is_zero {
Expand All @@ -76,7 +76,7 @@ impl Intf {
if ret.len_digits == max_sd_in {
if let Some(next_ch) = str_it.next() {
match next_ch {
'0'...'9' => {
'0'..='9' => {
ret.past_max = true;
}
_ => {
Expand Down
2 changes: 1 addition & 1 deletion src/printf/tokenize/num_format/num_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn get_inprefix(str_in: &String, field_type: &FieldType) -> InPrefix {
ret.radix_in = Base::Hex;
do_clean_lead_zeroes = true;
}
e @ '0'...'9' => {
e @ '0'..='9' => {
ret.offset += 1;
match *field_type {
FieldType::Intf => {
Expand Down
2 changes: 1 addition & 1 deletion src/printf/tokenize/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl SubParser {
while let Some(ch) = it.next() {
self.text_so_far.push(ch);
match ch as char {
'-' | '*' | '0'...'9' => {
'-' | '*' | '0'..='9' => {
if !self.past_decimal {
if self.min_width_is_asterisk || self.specifiers_found {
err_conv(&self.text_so_far);
Expand Down
4 changes: 2 additions & 2 deletions src/printf/tokenize/unescaped_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ impl UnescapedText {
None => '\\',
};
match ch {
'0'...'9' | 'x' => {
'0'..='9' | 'x' => {
let min_len = 1;
let mut max_len = 2;
let mut base = 16;
let ignore = false;
match ch {
'x' => {}
e @ '0'...'9' => {
e @ '0'..='9' => {
max_len = 3;
base = 8;
// in practice, gnu coreutils printf
Expand Down
2 changes: 1 addition & 1 deletion tests/common/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub fn log_info<T: AsRef<str>, U: AsRef<str>>(msg: T, par: U) {

pub fn recursive_copy(src: &Path, dest: &Path) -> Result<()> {
if fs::metadata(src)?.is_dir() {
for entry in try!(fs::read_dir(src)) {
for entry in fs::read_dir(src)? {
let entry = entry?;
let mut new_dest = PathBuf::from(dest);
new_dest.push(entry.file_name());
Expand Down