Skip to content

Commit

Permalink
trim_end: no need for mut record parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster authored and koraa committed Jan 26, 2024
1 parent 1d3c47e commit 1078e77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ fn uniq_cmd(delim: u8, include_trailing: bool) -> Result<()> {
Ok(())
}

fn trim_end(mut record: &[u8], delim: u8) -> &[u8] {
if record.last_byte() == Some(delim) {
record = &record[..record.len() - 1];
fn trim_end(record: &[u8], delim: u8) -> &[u8] {
match record.last_byte() {
Some(b) if b == delim => &record[..record.len() - 1],
_ => record,
}
record
}

fn try_main() -> Result<()> {
Expand Down

0 comments on commit 1078e77

Please sign in to comment.