Small fixes in thread local code.

This commit is contained in:
Mara Bos 2021-12-20 19:21:53 +01:00
parent c68c384b88
commit 3b9e214c40

View File

@ -630,7 +630,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
where
F: FnOnce(&T) -> R,
{
self.with(|cell| f(&mut cell.borrow()))
self.with(|cell| f(&cell.borrow()))
}
/// Acquires a mutable reference to the contained value.
@ -703,7 +703,7 @@ impl<T: 'static> LocalKey<RefCell<T>> {
// The cell was already initialized, so `value` wasn't used to
// initialize it. So we overwrite the current value with the
// new one instead.
cell.replace(init.into_inner());
*cell.borrow_mut() = value.into_inner();
}
});
}