diff --git a/src/od/parse_formats.rs b/src/od/parse_formats.rs index d9731e78d..9a431aeb9 100644 --- a/src/od/parse_formats.rs +++ b/src/od/parse_formats.rs @@ -107,7 +107,7 @@ pub fn parse_format_flags(args: &Vec) -> Result formats.extend(v.into_iter()), @@ -131,7 +131,7 @@ pub fn parse_format_flags(args: &Vec) -> Result = None; - while let Some(c) = str_it.next() { + for c in str_it { match c { e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => { if !hex_input { @@ -255,7 +255,7 @@ pub fn get_primitive_dec( let mut m: isize = 0; let mut pre = String::from("0"); let mut post = String::from("0"); - while let Some((i, c)) = it.next() { + for (i, c) in it { match c { '0' => {} _ => { diff --git a/src/printf/tokenize/num_format/num_format.rs b/src/printf/tokenize/num_format/num_format.rs index 4289ec842..b7e9ebfa1 100644 --- a/src/printf/tokenize/num_format/num_format.rs +++ b/src/printf/tokenize/num_format/num_format.rs @@ -49,7 +49,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option { return Some(match byte_it.next() { Some(second_byte) => { let mut ignored: Vec = Vec::new(); - while let Some(cont) = byte_it.next() { + for cont in byte_it { ignored.push(cont); } if ignored.len() > 0 { @@ -159,7 +159,7 @@ fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix { } if do_clean_lead_zeroes { let mut first = true; - while let Some(ch_zero) = str_it.next() { + for ch_zero in str_it { // see notes on offset above: // this is why the offset for octals and decimals // that reach this branch is 1 even though diff --git a/src/printf/tokenize/sub.rs b/src/printf/tokenize/sub.rs index fb604bf35..bab586baa 100644 --- a/src/printf/tokenize/sub.rs +++ b/src/printf/tokenize/sub.rs @@ -177,7 +177,7 @@ impl SubParser { // divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z]) // into min_width, second_field, field_char - while let Some(ch) = it.next() { + for ch in it { self.text_so_far.push(ch); match ch as char { '-' | '*' | '0'..='9' => { diff --git a/src/stat/stat.rs b/src/stat/stat.rs index 6d0eff468..2aa8a0d44 100644 --- a/src/stat/stat.rs +++ b/src/stat/stat.rs @@ -136,7 +136,7 @@ impl ScanUtil for str { Some('-') | Some('+') | Some('0'..='9') => i += 1, _ => return None, } - while let Some(c) = chars.next() { + for c in chars { match c { '0'..='9' => i += 1, _ => break, @@ -155,10 +155,10 @@ impl ScanUtil for str { 16 => 2, _ => return None, }; - let mut chars = self.chars().enumerate(); + let chars = self.chars().enumerate(); let mut res = 0_u32; let mut offset = 0_usize; - while let Some((i, c)) = chars.next() { + for (i, c) in chars { if i >= count { break; }