1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-04 15:07:47 +00:00

refactor/polish ~ fix cargo clippy complaints (use +=/-= notation)

This commit is contained in:
Roy Ivy III 2019-12-28 12:52:28 -06:00
parent 768ed71725
commit 493f5f1496
2 changed files with 4 additions and 4 deletions

View file

@ -72,7 +72,7 @@ fn format_float(f: f64, width: usize, precision: usize) -> String {
let r = 10f64.powi(l); let r = 10f64.powi(l);
if (f > 0.0 && r > f) || (f < 0.0 && -r < f) { if (f > 0.0 && r > f) || (f < 0.0 && -r < f) {
// fix precision error // fix precision error
l = l - 1; l -= 1;
} }
if l >= 0 && l <= (precision as i32 - 1) { if l >= 0 && l <= (precision as i32 - 1) {

View file

@ -79,12 +79,12 @@ impl Uniq {
let mut i = 0; let mut i = 0;
while field < skip_fields && i < line.len() { while field < skip_fields && i < line.len() {
while i < line.len() && line.chars().nth(i).unwrap().is_whitespace() { while i < line.len() && line.chars().nth(i).unwrap().is_whitespace() {
i = i + 1; i += 1;
} }
while i < line.len() && !line.chars().nth(i).unwrap().is_whitespace() { while i < line.len() && !line.chars().nth(i).unwrap().is_whitespace() {
i = i + 1; i += 1;
} }
field = field + 1; field += 1;
} }
&line[i..] &line[i..]
} else { } else {