Make clippy happy

This commit is contained in:
Jonathan Kelley 2024-02-04 23:03:52 -08:00
parent 7d78e5e250
commit 4a7fe938ad
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
17 changed files with 39 additions and 41 deletions

View file

@ -7,7 +7,7 @@ use dioxus_core::ElementId;
#[test]
fn empty_fragment_creates_nothing() {
fn app() -> Element {
rsx!({ () })
rsx!({})
}
let mut vdom = VirtualDom::new(app);

View file

@ -218,7 +218,6 @@ fn create_random_dynamic_attr() -> Attribute {
random_ns(),
rand::random(),
)
.into()
}
static mut TEMPLATE_COUNT: usize = 0;

View file

@ -36,7 +36,7 @@ async fn it_works() {
});
});
rsx!({ () })
rsx!({})
}
run_vdom(app).await;
@ -76,7 +76,7 @@ async fn yield_now_works() {
})
});
rsx!({ () })
rsx!({})
}
run_vdom(app).await;
@ -110,7 +110,7 @@ async fn flushing() {
})
});
rsx!({ () })
rsx!({})
}
let mut dom = VirtualDom::new(app);

View file

@ -28,7 +28,7 @@ criterion_main!(mbenches);
fn create_rows(c: &mut Criterion) {
c.bench_function("create rows", |b| {
let mut dom = VirtualDom::new(app);
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
b.iter(|| {
dom.rebuild(&mut NoOpMutations);

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;

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()
}
}

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;
}

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

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
})
}

View file

@ -249,7 +249,7 @@ fn to_string_works() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
let mut renderer = Renderer::new();
let out = renderer.render(&dom);
@ -299,7 +299,7 @@ fn empty_for_loop_works() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
let mut renderer = Renderer::new();
let out = renderer.render(&dom);
@ -336,7 +336,7 @@ fn empty_render_works() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
let mut renderer = Renderer::new();
let out = renderer.render(&dom);

View file

@ -10,7 +10,7 @@ fn static_boolean_attributs() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::render(&dom),
@ -28,7 +28,7 @@ fn dynamic_boolean_attributs() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::render(&dom),

View file

@ -7,7 +7,7 @@ fn root_ids() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -25,7 +25,7 @@ fn dynamic_attributes() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -42,7 +42,7 @@ fn listeners() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -57,7 +57,7 @@ fn listeners() {
}
let mut dom = VirtualDom::new(app2);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -75,7 +75,7 @@ fn text_nodes() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -90,7 +90,7 @@ fn text_nodes() {
}
let mut dom = VirtualDom::new(app2);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -110,7 +110,7 @@ fn components_hydrate() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -129,7 +129,7 @@ fn components_hydrate() {
}
let mut dom = VirtualDom::new(app2);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -145,7 +145,7 @@ fn components_hydrate() {
}
let mut dom = VirtualDom::new(app3);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -165,7 +165,7 @@ fn components_hydrate() {
}
let mut dom = VirtualDom::new(app4);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),
@ -188,7 +188,7 @@ fn hello_world_hydrates() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::pre_render(&dom),

View file

@ -7,7 +7,7 @@ fn static_inner_html() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(dioxus_ssr::render(&dom), r#"<div><div>1234</div></div>"#);
}
@ -20,7 +20,7 @@ fn dynamic_inner_html() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(dioxus_ssr::render(&dom), r#"<div><div>1234</div></div>"#);
}

View file

@ -9,7 +9,7 @@ fn simple() {
}
let mut dom = VirtualDom::new(App);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(dioxus_ssr::render(&dom), "<div>hello!</div>");

View file

@ -7,7 +7,7 @@ fn static_styles() {
}
let mut dom = VirtualDom::new(app);
_ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
assert_eq!(
dioxus_ssr::render(&dom),

View file

@ -38,7 +38,7 @@ fn main() {
tracing_wasm::set_as_global_default();
let mut dom = VirtualDom::new(app);
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
let pre = dioxus_ssr::pre_render(&dom);
tracing::trace!("{}", pre);

View file

@ -41,7 +41,7 @@ fn rehydrates() {
}
let mut dom = VirtualDom::new(app);
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
dom.rebuild(&mut dioxus_core::NoOpMutations);
let out = dioxus_ssr::render(&dom);
window()