Skip to content

Commit

Permalink
csplit: swapped if and else blocks for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Felle33 committed Jan 8, 2025
1 parent c1901fc commit 8cd5e21
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/uu/csplit/src/csplit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,18 +431,18 @@ impl SplitWriter<'_> {
for line in input_iter.shrink_buffer_to_size() {
self.writeln(&line)?;
}
if !self.options.suppress_matched {
if self.options.suppress_matched {
// since offset_usize is for sure greater than 0
// the first element of the buffer should be removed and this
// line inserted to be coherent with GNU implementation
input_iter.add_line_to_buffer(ln, l);
} else {
// add 1 to the buffer size to make place for the matched line
input_iter.set_size_of_buffer(offset_usize + 1);
assert!(
input_iter.add_line_to_buffer(ln, l).is_none(),
"should be big enough to hold every lines"
);
} else {
// since offset_usize is for sure greater than 0
// the first element of the buffer should be removed and this
// line inserted to be coherent with GNU implementation
input_iter.add_line_to_buffer(ln, l);
}

self.finish_split();
Expand Down

0 comments on commit 8cd5e21

Please sign in to comment.