From 493f5f14965fd657a4c2e915fb0ed2dd2666abea Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sat, 28 Dec 2019 12:52:28 -0600 Subject: [PATCH] refactor/polish ~ fix `cargo clippy` complaints (use `+=`/`-=` notation) --- src/od/prn_float.rs | 2 +- src/uniq/uniq.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/od/prn_float.rs b/src/od/prn_float.rs index 19ba3cca3..1a4ba6ce0 100644 --- a/src/od/prn_float.rs +++ b/src/od/prn_float.rs @@ -72,7 +72,7 @@ fn format_float(f: f64, width: usize, precision: usize) -> String { let r = 10f64.powi(l); if (f > 0.0 && r > f) || (f < 0.0 && -r < f) { // fix precision error - l = l - 1; + l -= 1; } if l >= 0 && l <= (precision as i32 - 1) { diff --git a/src/uniq/uniq.rs b/src/uniq/uniq.rs index 83112a60b..8554d4571 100644 --- a/src/uniq/uniq.rs +++ b/src/uniq/uniq.rs @@ -79,12 +79,12 @@ impl Uniq { let mut i = 0; while field < skip_fields && i < line.len() { 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() { - i = i + 1; + i += 1; } - field = field + 1; + field += 1; } &line[i..] } else {