rev: use "==" instead of "!="

This commit is contained in:
Daniel Hofstetter
2024-07-30 09:17:19 +02:00
parent 258b44dc55
commit 1b5d8f3efe

@ -54,15 +54,15 @@ fn rev_stream(stream: impl Read, sep: u8) -> std::io::Result<()> {
loop {
buf.clear();
stream.read_until(sep, &mut buf)?;
if buf.last().copied() != Some(sep) {
buf.reverse();
stdout.write_all(&buf)?;
break;
} else {
if buf.last().copied() == Some(sep) {
buf.pop();
buf.reverse();
buf.push(sep);
stdout.write_all(&buf)?;
} else {
buf.reverse();
stdout.write_all(&buf)?;
break;
}
}
Ok(())