Skip to content

Commit

Permalink
chore: remove newly-detected unused tuple fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Jan 6, 2024
1 parent 16cf3c4 commit d839be1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions leptos_reactive/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,12 +951,11 @@ impl RuntimeId {
false
};

let prev_observer =
SetObserverOnDrop(self, runtime.observer.take());
let prev_observer = SetObserverOnDrop(runtime.observer.take());

untracked_result = f();

runtime.observer.set(prev_observer.1);
runtime.observer.set(prev_observer.0);
std::mem::forget(prev_observer); // avoid Drop

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -1371,12 +1370,12 @@ impl std::hash::Hash for Runtime {
}
}

struct SetObserverOnDrop(RuntimeId, Option<NodeId>);
struct SetObserverOnDrop(Option<NodeId>);

impl Drop for SetObserverOnDrop {
fn drop(&mut self) {
_ = with_runtime(|rt| {
rt.observer.set(self.1);
rt.observer.set(self.0);
});
}
}
Expand All @@ -1393,14 +1392,13 @@ impl Drop for SetObserverOnDrop {
)]
#[inline(always)]
pub fn batch<T>(f: impl FnOnce() -> T) -> T {
let runtime_id = Runtime::current();
with_runtime(move |runtime| {
let batching = SetBatchingOnDrop(runtime_id, runtime.batching.get());
let batching = SetBatchingOnDrop(runtime.batching.get());
runtime.batching.set(true);

let val = f();

runtime.batching.set(batching.1);
runtime.batching.set(batching.0);
std::mem::forget(batching);

runtime.run_effects();
Expand All @@ -1409,12 +1407,12 @@ pub fn batch<T>(f: impl FnOnce() -> T) -> T {
.expect("tried to run a batched update in a runtime that has been disposed")
}

struct SetBatchingOnDrop(RuntimeId, bool);
struct SetBatchingOnDrop(bool);

impl Drop for SetBatchingOnDrop {
fn drop(&mut self) {
_ = with_runtime(|rt| {
rt.batching.set(self.1);
rt.batching.set(self.0);
});
}
}
Expand Down

0 comments on commit d839be1

Please sign in to comment.