Skip to content

Commit 75578de

Browse files
committed
Fix clippy
Signed-off-by: Nico Burns <[email protected]>
1 parent 65e0a9f commit 75578de

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

examples/08-apis/drag_and_drop.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ fn app() -> Element {
4242
background_color: "#f0f0f0",
4343
ondragover: |e| e.prevent_default(),
4444
ondrop: move |e| {
45-
if let Some(item_id) = e.data_transfer().get_data("text/plain").and_then(|data| data.parse::<usize>().ok()) {
46-
if let Some(pos) = items.iter().position(|item| item.id == item_id) {
47-
items.write()[pos].category = category.to_string();
48-
}
45+
if let Some(item_id) = e.data_transfer().get_data("text/plain").and_then(|data| data.parse::<usize>().ok())
46+
&& let Some(pos) = items.iter().position(|item| item.id == item_id) {
47+
items.write()[pos].category = category.to_string();
4948
}
5049
},
5150
h2 { "Category: {category}" }

examples/08-apis/read_size.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ fn app() -> Element {
2020
let read = div_element.read();
2121
let client_rect = read.as_ref().map(|el| el.get_client_rect());
2222

23-
if let Some(client_rect) = client_rect {
24-
if let Ok(rect) = client_rect.await {
25-
dimensions.set(rect);
26-
}
23+
if let Some(client_rect) = client_rect
24+
&& let Ok(rect) = client_rect.await
25+
{
26+
dimensions.set(rect);
2727
}
2828
};
2929

0 commit comments

Comments
 (0)