Make clippy happy
This commit is contained in:
17 files changed
+39
-41
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user