Mercurial > lbo > hg > leveldb-rs
changeset 552:f43574f976dc
LRUList: remove last unnecessary use of mem::replace
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Mon, 07 Mar 2022 22:00:31 +0100 |
parents | 05dac197bc8d |
children | bd8c4d4688d5 |
files | src/cache.rs |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cache.rs Mon Mar 07 21:52:56 2022 +0100 +++ b/src/cache.rs Mon Mar 07 22:00:31 2022 +0100 @@ -1,5 +1,5 @@ use std::collections::HashMap; -use std::mem::{replace, swap}; +use std::mem::swap; // No clone, no copy! That asserts that an LRUHandle exists only once. type LRUHandle<T> = *mut LRUNode<T>; @@ -43,7 +43,7 @@ // Set up the node after the new one self.head.next.as_mut().unwrap().prev = Some(newp); // Replace head.next with None and set the new node's next to that - new.next = replace(&mut self.head.next, None); + new.next = self.head.next.take(); self.head.next = Some(new); newp