diff --git a/any_error/src/lib.rs b/any_error/src/lib.rs index 1cb78f2ad..d820096cd 100644 --- a/any_error/src/lib.rs +++ b/any_error/src/lib.rs @@ -9,7 +9,7 @@ use std::{ error, fmt::{self, Display}, future::Future, - mem, ops, + ops, pin::Pin, sync::Arc, task::{Context, Poll}, @@ -109,7 +109,7 @@ pub fn get_error_hook() -> Option> { /// Sets the current thread-local error hook, which will be invoked when [`throw`] is called. pub fn set_error_hook(hook: Arc) -> ResetErrorHookOnDrop { ResetErrorHookOnDrop( - ERROR_HOOK.with_borrow_mut(|this| mem::replace(this, Some(hook))), + ERROR_HOOK.with_borrow_mut(|this| Option::replace(this, hook)), ) } diff --git a/reactive_graph/src/owner.rs b/reactive_graph/src/owner.rs index 81ce78338..dc575f76b 100644 --- a/reactive_graph/src/owner.rs +++ b/reactive_graph/src/owner.rs @@ -208,9 +208,7 @@ impl Owner { /// Runs the given function with this as the current `Owner`. pub fn with(&self, fun: impl FnOnce() -> T) -> T { let prev = { - OWNER.with(|o| { - mem::replace(&mut *o.borrow_mut(), Some(self.clone())) - }) + OWNER.with(|o| Option::replace(&mut *o.borrow_mut(), self.clone())) }; #[cfg(feature = "sandboxed-arenas")] Arena::set(&self.inner.read().or_poisoned().arena); diff --git a/reactive_graph/src/transition.rs b/reactive_graph/src/transition.rs index 7e59051fb..557559268 100644 --- a/reactive_graph/src/transition.rs +++ b/reactive_graph/src/transition.rs @@ -37,9 +37,9 @@ impl AsyncTransition { let (tx, rx) = mpsc::channel(); let global_transition = global_transition(); let inner = TransitionInner { tx }; - let prev = std::mem::replace( + let prev = Option::replace( &mut *global_transition.write().or_poisoned(), - Some(inner.clone()), + inner.clone(), ); let value = action().await; _ = std::mem::replace(