clippy: rewrite comparison chains

chunk_stream one can be collapsed, since split == split_to with at set
to buffer.len() anyway.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-20 17:23:50 +01:00
committed by Wolfgang Bumiller
parent 81b2a87232
commit 43313c2ee7
4 changed files with 10 additions and 8 deletions

View File

@ -98,11 +98,8 @@ where
fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Result<BytesMut, S::Error>>> {
let this = self.get_mut();
loop {
if this.buffer.len() == this.chunk_size {
return Poll::Ready(Some(Ok(this.buffer.split())));
} else if this.buffer.len() > this.chunk_size {
let result = this.buffer.split_to(this.chunk_size);
return Poll::Ready(Some(Ok(result)));
if this.buffer.len() >= this.chunk_size {
return Poll::Ready(Some(Ok(this.buffer.split_to(this.chunk_size))));
}
match ready!(Pin::new(&mut this.input).try_poll_next(cx)) {