fix clippy

This commit is contained in:
Evan Almloff committed 2023-03-26 07:23:32 -05:00
1 parent 84d0b8e9e0
commit c4027c2618
2 files changed
+7 -4

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ fn main() {
}
fn app(cx: Scope) -> Element {
let elements: &UseRef<Vec<Rc<MountedData>>> = use_ref(cx, || Vec::new());
let elements: &UseRef<Vec<Rc<MountedData>>> = use_ref(cx, Vec::new);
let running = use_state(cx, || true);
use_future!(cx, |(elements, running)| async move {
+6 -3
View File
@@ -1,3 +1,4 @@
#![allow(clippy::await_holding_refcell_ref)]
use std::rc::Rc;
use dioxus::{html::geometry::euclid::Rect, prelude::*};
@@ -27,7 +28,7 @@ fn main() {
fn app(cx: Scope) -> Element {
let div_element: &UseRef<Option<Rc<MountedData>>> = use_ref(cx, || None);
let dimentions = use_ref(cx, || Rect::zero());
let dimentions = use_ref(cx, Rect::zero);
cx.render(rsx!(
div {
@@ -44,8 +45,10 @@ fn app(cx: Scope) -> Element {
onclick: move |_| {
to_owned![div_element, dimentions];
async move {
if let Some(div) = div_element.read().as_ref() {
if let Ok(rect)=div.get_client_rect().await{
let read = div_element.read();
let client_rect = read.as_ref().map(|el| el.get_client_rect());
if let Some(client_rect) = client_rect {
if let Ok(rect) = client_rect.await {
dimentions.set(rect);
}
}