Skip to content

Commit

Permalink
(un)expand, uniq: Fix clipply lints
Browse files Browse the repository at this point in the history
  • Loading branch information
GrayJack committed Aug 26, 2020
1 parent 0aee155 commit f339463
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion expand/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion unexpand/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion unexpand/src/tab_stops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 4 additions & 5 deletions uniq/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand All @@ -44,6 +44,7 @@ struct Flags {
supress_unique: bool, // -d | --repeated
supress_repeated: bool, // -u | --unique
skip_chars: Option<u64>, // -s | --skip-chars=N
#[allow(dead_code)]
skip_fields: Option<u64>, // -f | --skip-fields=N
}

Expand Down Expand Up @@ -170,10 +171,8 @@ fn uniq<R: Read, W: Write>(
if line_changed && last_line_count == 1 {
line_to_show = Some(&last_line);
}
} else {
if line_changed {
line_to_show = Some(&current_line);
}
} else if line_changed {
line_to_show = Some(&current_line);
}

if let Some(line) = line_to_show {
Expand Down

0 comments on commit f339463

Please sign in to comment.