diff --git a/expand/src/main.rs b/expand/src/main.rs index 1b132ec9..622be958 100644 --- a/expand/src/main.rs +++ b/expand/src/main.rs @@ -94,7 +94,7 @@ impl Expand { Ok(Expand { initial, tabstops }) } - fn expand_line(self: &mut Self, line: &str) -> String { + fn expand_line(&mut self, line: &str) -> String { let mut convert = true; let mut column = 0; let mut new_line: String = String::new(); diff --git a/unexpand/src/main.rs b/unexpand/src/main.rs index 397840e0..a8eedb8f 100644 --- a/unexpand/src/main.rs +++ b/unexpand/src/main.rs @@ -103,7 +103,7 @@ impl Unexpand { Unexpand { all, tabs } } - fn unexpand_line(self: &mut Self, line: &str) -> String { + fn unexpand_line(&mut self, line: &str) -> String { let mut convert = true; let mut spaces: i32 = 0; let mut column: i32 = 0; diff --git a/unexpand/src/tab_stops.rs b/unexpand/src/tab_stops.rs index 443fbb51..d5e35946 100644 --- a/unexpand/src/tab_stops.rs +++ b/unexpand/src/tab_stops.rs @@ -92,7 +92,7 @@ impl TabStops { } } - pub fn is_tab_stop(self: &Self, column: usize) -> bool { + pub fn is_tab_stop(&self, column: usize) -> bool { if self.positions.contains(&column) { return true; } diff --git a/uniq/src/main.rs b/uniq/src/main.rs index 62ebf4b0..3245cce8 100644 --- a/uniq/src/main.rs +++ b/uniq/src/main.rs @@ -32,7 +32,7 @@ fn main() { })) }; - if let Err(_) = uniq(&mut reader, &mut writer, flags) { + if uniq(&mut reader, &mut writer, flags).is_err() { process::exit(1); }; } @@ -44,6 +44,7 @@ struct Flags { supress_unique: bool, // -d | --repeated supress_repeated: bool, // -u | --unique skip_chars: Option, // -s | --skip-chars=N + #[allow(dead_code)] skip_fields: Option, // -f | --skip-fields=N } @@ -170,10 +171,8 @@ fn uniq( if line_changed && last_line_count == 1 { line_to_show = Some(&last_line); } - } else { - if line_changed { - line_to_show = Some(¤t_line); - } + } else if line_changed { + line_to_show = Some(¤t_line); } if let Some(line) = line_to_show {