Make clippy happy

This commit is contained in:
Jonathan Kelley committed 2024-02-04 23:03:52 -08:00
1 parent 7d78e5e250
commit 4a7fe938ad
17 files changed
+39 -41

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ pub fn use_effect(mut callback: impl FnMut() + 'static) {
flush_sync().await;
// Run the effect
rc.run_in(|| callback());
rc.run_in(&mut callback);
// Wait for context to change
rc.changed().await;
+2 -2
View File
@@ -117,13 +117,13 @@ impl UseFuture {
/// Reading this does not subscribe to the future's state
pub fn finished(&self) -> bool {
matches!(
self.state.peek().clone(),
*self.state.peek(),
UseFutureState::Ready | UseFutureState::Stopped
)
}
/// Get the current state of the future.
pub fn state(&self) -> ReadOnlySignal<UseFutureState> {
self.state.clone().into()
self.state.into()
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ pub fn use_maybe_sync_memo<R: PartialEq, S: Storage<SignalData<R>>>(
// Wait for the dom the be finished with sync work
flush_sync().await;
rc.changed().await;
let new = rc.run_in(|| f());
let new = rc.run_in(&mut f);
if new != *state.peek() {
*state.write() = new;
}
+1 -1
View File
@@ -149,7 +149,7 @@ impl<T> Resource<T> {
/// Get the current value of the future.
pub fn value(&self) -> Option<ReadOnlySignal<T>> {
self.value.peek().as_ref().map(|sig| sig.clone().into())
self.value.peek().as_ref().map(|sig| (*sig).into())
}
/// Wait for this async memo to resolve, returning the inner signal value
+7 -8
View File
@@ -86,17 +86,16 @@ fn use_maybe_signal_sync<T: 'static, U: Storage<SignalData<T>>>(
#[cfg(debug_assertions)]
let caller = std::panic::Location::caller();
let signal = use_hook(|| {
// todo: (jon)
// By default, we want to unsubscribe the current component from the signal on every render
// any calls to .read() in the body will re-subscribe the component to the signal
// use_before_render(move || signal.unsubscribe(current_scope_id().unwrap()));
use_hook(|| {
Signal::new_with_caller(
f(),
#[cfg(debug_assertions)]
caller,
)
});
// By default, we want to unsubscribe the current component from the signal on every render
// any calls to .read() in the body will re-subscribe the component to the signal
// use_before_render(move || signal.unsubscribe(current_scope_id().unwrap()));
signal
})
}