mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-04 15:07:47 +00:00
refactor/polish ~ fix cargo clippy
complaints (use enumerate)
This commit is contained in:
parent
33e5d8c813
commit
de9d702a32
2 changed files with 2 additions and 7 deletions
|
@ -487,10 +487,7 @@ fn prefix_operator_index(values: &[String]) -> Result<String, String> {
|
|||
let haystack = &values[0];
|
||||
let needles = &values[1];
|
||||
|
||||
let mut current_idx = 0;
|
||||
for ch_h in haystack.chars() {
|
||||
current_idx += 1;
|
||||
|
||||
for (current_idx, ch_h) in haystack.chars().enumerate() {
|
||||
for ch_n in needles.chars() {
|
||||
if ch_n == ch_h {
|
||||
return Ok(current_idx.to_string());
|
||||
|
|
|
@ -226,13 +226,11 @@ pub fn base_conv_float(src: &[u8], radix_src: u8, radix_dest: u8) -> f64 {
|
|||
result.push(0);
|
||||
let mut factor: f64 = 1_f64;
|
||||
let radix_src_float: f64 = f64::from(radix_src);
|
||||
let mut i = 0;
|
||||
let mut r: f64 = 0_f64;
|
||||
for u in src {
|
||||
for (i, u) in src.iter().enumerate() {
|
||||
if i > 15 {
|
||||
break;
|
||||
}
|
||||
i += 1;
|
||||
factor /= radix_src_float;
|
||||
r += factor * f64::from(*u)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue