fix clippy
This commit is contained in:
1 parent
84d0b8e9e0
commit
c4027c2618
2 files changed
+7
-4
No files matched your search
@@ -7,7 +7,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
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);
|
let running = use_state(cx, || true);
|
||||||
|
|
||||||
use_future!(cx, |(elements, running)| async move {
|
use_future!(cx, |(elements, running)| async move {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#![allow(clippy::await_holding_refcell_ref)]
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use dioxus::{html::geometry::euclid::Rect, prelude::*};
|
use dioxus::{html::geometry::euclid::Rect, prelude::*};
|
||||||
@@ -27,7 +28,7 @@ fn main() {
|
|||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
let div_element: &UseRef<Option<Rc<MountedData>>> = use_ref(cx, || None);
|
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!(
|
cx.render(rsx!(
|
||||||
div {
|
div {
|
||||||
@@ -44,8 +45,10 @@ fn app(cx: Scope) -> Element {
|
|||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
to_owned![div_element, dimentions];
|
to_owned![div_element, dimentions];
|
||||||
async move {
|
async move {
|
||||||
if let Some(div) = div_element.read().as_ref() {
|
let read = div_element.read();
|
||||||
if let Ok(rect)=div.get_client_rect().await{
|
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);
|
dimentions.set(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user