Enable clippy
This commit is contained in:
1 parent
4f1894ff5c
commit
b6903bf558
14 files changed
+46
-50
No files matched your search
@@ -171,7 +171,7 @@ where
|
||||
///
|
||||
///
|
||||
///
|
||||
pub fn use_context_provider<'a, T: 'static>(cx: &'a ScopeState, f: impl FnOnce() -> T) {
|
||||
pub fn use_context_provider<T: 'static>(cx: &ScopeState, f: impl FnOnce() -> T) {
|
||||
cx.use_hook(|_| {
|
||||
let state: ProvidedState<T> = RefCell::new(ProvidedStateInner {
|
||||
value: Rc::new(RefCell::new(f())),
|
||||
|
||||
@@ -15,10 +15,7 @@ let g = use_coroutine(&cx, || {
|
||||
|
||||
|
||||
*/
|
||||
pub fn use_coroutine<'a, F>(
|
||||
cx: &'a ScopeState,
|
||||
create_future: impl FnOnce() -> F,
|
||||
) -> CoroutineHandle<'a>
|
||||
pub fn use_coroutine<F>(cx: &ScopeState, create_future: impl FnOnce() -> F) -> CoroutineHandle<'_>
|
||||
where
|
||||
F: Future<Output = ()> + 'static,
|
||||
{
|
||||
@@ -98,6 +95,7 @@ impl Clone for CoroutineHandle<'_> {
|
||||
impl Copy for CoroutineHandle<'_> {}
|
||||
|
||||
impl<'a> CoroutineHandle<'a> {
|
||||
#[allow(clippy::needless_return)]
|
||||
pub fn start(&self) {
|
||||
if self.is_running() {
|
||||
return;
|
||||
|
||||
@@ -6,12 +6,10 @@ use std::{
|
||||
use dioxus_core::ScopeState;
|
||||
|
||||
pub fn use_ref<'a, T: 'static>(cx: &'a ScopeState, f: impl FnOnce() -> T) -> &'a UseRef<T> {
|
||||
let inner = cx.use_hook(|_| UseRef {
|
||||
cx.use_hook(|_| UseRef {
|
||||
update_callback: cx.schedule_update(),
|
||||
value: Rc::new(RefCell::new(f())),
|
||||
});
|
||||
|
||||
inner
|
||||
})
|
||||
}
|
||||
|
||||
pub struct UseRef<T> {
|
||||
|
||||
@@ -27,7 +27,7 @@ pub fn use_suspense<R: 'static, F: Future<Output = R> + 'static>(
|
||||
});
|
||||
|
||||
if let Some(value) = sus.value.as_ref() {
|
||||
render(&value)
|
||||
render(value)
|
||||
} else {
|
||||
// generate a placeholder node if the future isnt ready
|
||||
None
|
||||
|
||||
Reference in new issue
Block a user