mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (while let ... = some
=> for ... in
)
This commit is contained in:
parent
8142ecf325
commit
e676447b3d
5 changed files with 10 additions and 10 deletions
|
@ -107,7 +107,7 @@ pub fn parse_format_flags(args: &Vec<String>) -> Result<Vec<ParsedFormatterItemI
|
||||||
let mut arg_iter = args.iter().skip(1);
|
let mut arg_iter = args.iter().skip(1);
|
||||||
let mut expect_type_string = false;
|
let mut expect_type_string = false;
|
||||||
|
|
||||||
while let Some(arg) = arg_iter.next() {
|
for arg in arg_iter {
|
||||||
if expect_type_string {
|
if expect_type_string {
|
||||||
match parse_type_string(arg) {
|
match parse_type_string(arg) {
|
||||||
Ok(v) => formats.extend(v.into_iter()),
|
Ok(v) => formats.extend(v.into_iter()),
|
||||||
|
@ -131,7 +131,7 @@ pub fn parse_format_flags(args: &Vec<String>) -> Result<Vec<ParsedFormatterItemI
|
||||||
} else if arg.starts_with("-") {
|
} else if arg.starts_with("-") {
|
||||||
let mut flags = arg.chars().skip(1);
|
let mut flags = arg.chars().skip(1);
|
||||||
let mut format_spec = String::new();
|
let mut format_spec = String::new();
|
||||||
while let Some(c) = flags.next() {
|
for c in flags {
|
||||||
if expect_type_string {
|
if expect_type_string {
|
||||||
format_spec.push(c);
|
format_spec.push(c);
|
||||||
} else if od_argument_with_option(c) {
|
} else if od_argument_with_option(c) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ impl FloatAnalysis {
|
||||||
};
|
};
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let mut pos_before_first_nonzero_after_decimal: Option<usize> = None;
|
let mut pos_before_first_nonzero_after_decimal: Option<usize> = None;
|
||||||
while let Some(c) = str_it.next() {
|
for c in str_it {
|
||||||
match c {
|
match c {
|
||||||
e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => {
|
e @ '0'..='9' | e @ 'A'..='F' | e @ 'a'..='f' => {
|
||||||
if !hex_input {
|
if !hex_input {
|
||||||
|
@ -255,7 +255,7 @@ pub fn get_primitive_dec(
|
||||||
let mut m: isize = 0;
|
let mut m: isize = 0;
|
||||||
let mut pre = String::from("0");
|
let mut pre = String::from("0");
|
||||||
let mut post = String::from("0");
|
let mut post = String::from("0");
|
||||||
while let Some((i, c)) = it.next() {
|
for (i, c) in it {
|
||||||
match c {
|
match c {
|
||||||
'0' => {}
|
'0' => {}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn get_provided(str_in_opt: Option<&String>) -> Option<u8> {
|
||||||
return Some(match byte_it.next() {
|
return Some(match byte_it.next() {
|
||||||
Some(second_byte) => {
|
Some(second_byte) => {
|
||||||
let mut ignored: Vec<u8> = Vec::new();
|
let mut ignored: Vec<u8> = Vec::new();
|
||||||
while let Some(cont) = byte_it.next() {
|
for cont in byte_it {
|
||||||
ignored.push(cont);
|
ignored.push(cont);
|
||||||
}
|
}
|
||||||
if ignored.len() > 0 {
|
if ignored.len() > 0 {
|
||||||
|
@ -159,7 +159,7 @@ fn get_inprefix(str_in: &str, field_type: &FieldType) -> InPrefix {
|
||||||
}
|
}
|
||||||
if do_clean_lead_zeroes {
|
if do_clean_lead_zeroes {
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
while let Some(ch_zero) = str_it.next() {
|
for ch_zero in str_it {
|
||||||
// see notes on offset above:
|
// see notes on offset above:
|
||||||
// this is why the offset for octals and decimals
|
// this is why the offset for octals and decimals
|
||||||
// that reach this branch is 1 even though
|
// that reach this branch is 1 even though
|
||||||
|
|
|
@ -177,7 +177,7 @@ impl SubParser {
|
||||||
|
|
||||||
// divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z])
|
// divide substitution from %([0-9]+)?(.[0-9+])?([a-zA-Z])
|
||||||
// into min_width, second_field, field_char
|
// into min_width, second_field, field_char
|
||||||
while let Some(ch) = it.next() {
|
for ch in it {
|
||||||
self.text_so_far.push(ch);
|
self.text_so_far.push(ch);
|
||||||
match ch as char {
|
match ch as char {
|
||||||
'-' | '*' | '0'..='9' => {
|
'-' | '*' | '0'..='9' => {
|
||||||
|
|
|
@ -136,7 +136,7 @@ impl ScanUtil for str {
|
||||||
Some('-') | Some('+') | Some('0'..='9') => i += 1,
|
Some('-') | Some('+') | Some('0'..='9') => i += 1,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
}
|
}
|
||||||
while let Some(c) = chars.next() {
|
for c in chars {
|
||||||
match c {
|
match c {
|
||||||
'0'..='9' => i += 1,
|
'0'..='9' => i += 1,
|
||||||
_ => break,
|
_ => break,
|
||||||
|
@ -155,10 +155,10 @@ impl ScanUtil for str {
|
||||||
16 => 2,
|
16 => 2,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
let mut chars = self.chars().enumerate();
|
let chars = self.chars().enumerate();
|
||||||
let mut res = 0_u32;
|
let mut res = 0_u32;
|
||||||
let mut offset = 0_usize;
|
let mut offset = 0_usize;
|
||||||
while let Some((i, c)) = chars.next() {
|
for (i, c) in chars {
|
||||||
if i >= count {
|
if i >= count {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue