chore: fix some clippy lints (#3720)

This commit is contained in:
Nylonicious
2021-04-22 13:33:42 +02:00
committed by GitHub
parent 2b9b558108
commit 1e2f893da2
7 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -128,7 +128,7 @@ where
}
}
Poll::Ready(Ok(Some(mem::replace(me.buf, String::new()))))
Poll::Ready(Ok(Some(mem::take(me.buf))))
}
}
+2 -2
View File
@@ -36,7 +36,7 @@ where
{
ReadLine {
reader,
buf: mem::replace(string, String::new()).into_bytes(),
buf: mem::take(string).into_bytes(),
output: string,
read: 0,
_pin: PhantomPinned,
@@ -99,7 +99,7 @@ pub(super) fn read_line_internal<R: AsyncBufRead + ?Sized>(
read: &mut usize,
) -> Poll<io::Result<usize>> {
let io_res = ready!(read_until_internal(reader, cx, b'\n', buf, read));
let utf8_res = String::from_utf8(mem::replace(buf, Vec::new()));
let utf8_res = String::from_utf8(mem::take(buf));
// At this point both buf and output are empty. The allocation is in utf8_res.
+1 -1
View File
@@ -37,7 +37,7 @@ pub(crate) fn read_to_string<'a, R>(
where
R: AsyncRead + ?Sized + Unpin,
{
let buf = mem::replace(string, String::new()).into_bytes();
let buf = mem::take(string).into_bytes();
ReadToString {
reader,
buf: VecWithInitialized::new(buf),
+1 -1
View File
@@ -106,7 +106,7 @@ where
me.buf.pop();
}
Poll::Ready(Ok(Some(mem::replace(me.buf, Vec::new()))))
Poll::Ready(Ok(Some(mem::take(me.buf))))
}
}
+1 -1
View File
@@ -151,7 +151,7 @@ impl BlockingPool {
self.spawner.inner.condvar.notify_all();
let last_exited_thread = std::mem::take(&mut shared.last_exiting_thread);
let workers = std::mem::replace(&mut shared.worker_threads, HashMap::new());
let workers = std::mem::take(&mut shared.worker_threads);
drop(shared);
+1 -1
View File
@@ -205,7 +205,7 @@ impl<T> Receiver<T> {
// not memory access.
shared.ref_count_rx.fetch_add(1, Relaxed);
Self { version, shared }
Self { shared, version }
}
/// Returns a reference to the most recently sent value
+1 -1
View File
@@ -296,7 +296,7 @@ impl<T> Slab<T> {
// Remove the slots vector from the page. This is done so that the
// freeing process is done outside of the lock's critical section.
let vec = mem::replace(&mut slots.slots, vec![]);
let vec = mem::take(&mut slots.slots);
slots.head = 0;
// Drop the lock so we can drop the vector outside the lock below.