Enable clippy

This commit is contained in:
Alexandre Kirszenberg committed 2022-01-08 16:35:26 +01:00
1 parent 4f1894ff5c
commit b6903bf558
14 files changed
+46 -50

No files matched your search

+1 -1
View File
@@ -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())),
+2 -4
View File
@@ -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;
+2 -4
View File
@@ -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> {
+1 -1
View File
@@ -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