Skip to content

Commit 5eaaff0

Browse files
chore(clippy): replace mem::replace with Option::replace (#3668)
1 parent 63c9549 commit 5eaaff0

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

any_error/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99
error,
1010
fmt::{self, Display},
1111
future::Future,
12-
mem, ops,
12+
ops,
1313
pin::Pin,
1414
sync::Arc,
1515
task::{Context, Poll},
@@ -109,7 +109,7 @@ pub fn get_error_hook() -> Option<Arc<dyn ErrorHook>> {
109109
/// Sets the current thread-local error hook, which will be invoked when [`throw`] is called.
110110
pub fn set_error_hook(hook: Arc<dyn ErrorHook>) -> ResetErrorHookOnDrop {
111111
ResetErrorHookOnDrop(
112-
ERROR_HOOK.with_borrow_mut(|this| mem::replace(this, Some(hook))),
112+
ERROR_HOOK.with_borrow_mut(|this| Option::replace(this, hook)),
113113
)
114114
}
115115

reactive_graph/src/owner.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ impl Owner {
208208
/// Runs the given function with this as the current `Owner`.
209209
pub fn with<T>(&self, fun: impl FnOnce() -> T) -> T {
210210
let prev = {
211-
OWNER.with(|o| {
212-
mem::replace(&mut *o.borrow_mut(), Some(self.clone()))
213-
})
211+
OWNER.with(|o| Option::replace(&mut *o.borrow_mut(), self.clone()))
214212
};
215213
#[cfg(feature = "sandboxed-arenas")]
216214
Arena::set(&self.inner.read().or_poisoned().arena);

reactive_graph/src/transition.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ impl AsyncTransition {
3737
let (tx, rx) = mpsc::channel();
3838
let global_transition = global_transition();
3939
let inner = TransitionInner { tx };
40-
let prev = std::mem::replace(
40+
let prev = Option::replace(
4141
&mut *global_transition.write().or_poisoned(),
42-
Some(inner.clone()),
42+
inner.clone(),
4343
);
4444
let value = action().await;
4545
_ = std::mem::replace(

0 commit comments

Comments
 (0)