io: replace Vec method truncate(0) with clear (#8125)

https://rust-lang.github.io/rust-clippy/master/index.html#manual_clear
This commit is contained in:
xtqqczze
2026-05-08 08:38:49 +02:00
committed by GitHub
parent 02ff0833e0
commit 067f229371
+2 -2
View File
@@ -214,7 +214,7 @@ impl Buf {
self.pos += n;
if self.pos == self.buf.len() {
self.buf.truncate(0);
self.buf.clear();
self.pos = 0;
}
@@ -315,7 +315,7 @@ cfg_fs! {
pub(crate) fn discard_read(&mut self) -> i64 {
let ret = -(self.bytes().len() as i64);
self.pos = 0;
self.buf.truncate(0);
self.buf.clear();
ret
}