mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-07 00:00:09 +02:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user