Make clippy happy
This commit is contained in:
8 files changed
+20
-23
No files matched your search
@@ -15,7 +15,7 @@ fn app(cx: Scope) -> Element {
|
|||||||
if *running.current() {
|
if *running.current() {
|
||||||
loop {
|
loop {
|
||||||
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
tokio::time::sleep(std::time::Duration::from_millis(10)).await;
|
||||||
if let Some(element) = elements.read().get(focused) {
|
if let Some(element) = elements.with(|f| f.get(focused).cloned()) {
|
||||||
_ = element.set_focus(true).await;
|
_ = element.set_focus(true).await;
|
||||||
} else {
|
} else {
|
||||||
focused = 0;
|
focused = 0;
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ fn app(cx: Scope) -> Element {
|
|||||||
|
|
||||||
button {
|
button {
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
if let Some(header) = header_element.read().as_ref() {
|
if let Some(header) = header_element.read().as_ref().cloned() {
|
||||||
_ = header.scroll_to(ScrollBehavior::Smooth);
|
cx.spawn(async move {
|
||||||
|
let _ = header.scroll_to(ScrollBehavior::Smooth).await;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Scroll to top"
|
"Scroll to top"
|
||||||
|
|||||||
@@ -868,7 +868,7 @@ where
|
|||||||
nodes.extend(self.into_iter().map(|node| node.into_vnode(cx)));
|
nodes.extend(self.into_iter().map(|node| node.into_vnode(cx)));
|
||||||
|
|
||||||
match nodes.into_bump_slice() {
|
match nodes.into_bump_slice() {
|
||||||
children if children.is_empty() => DynamicNode::default(),
|
[] => DynamicNode::default(),
|
||||||
children => DynamicNode::Fragment(children),
|
children => DynamicNode::Fragment(children),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ impl ScopeContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut search_parent = self.parent_id;
|
let mut search_parent = self.parent_id;
|
||||||
match with_runtime(|runtime: &crate::runtime::Runtime| {
|
let cur_runtime = with_runtime(|runtime: &crate::runtime::Runtime| {
|
||||||
while let Some(parent_id) = search_parent {
|
while let Some(parent_id) = search_parent {
|
||||||
let parent = runtime.get_context(parent_id).unwrap();
|
let parent = runtime.get_context(parent_id).unwrap();
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
@@ -135,9 +135,9 @@ impl ScopeContext {
|
|||||||
search_parent = parent.parent_id;
|
search_parent = parent.parent_id;
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
})
|
});
|
||||||
.flatten()
|
|
||||||
{
|
match cur_runtime.flatten() {
|
||||||
Some(ctx) => Some(ctx),
|
Some(ctx) => Some(ctx),
|
||||||
None => {
|
None => {
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use dioxus_core::ElementId;
|
|||||||
#[test]
|
#[test]
|
||||||
fn empty_fragment_creates_nothing() {
|
fn empty_fragment_creates_nothing() {
|
||||||
fn app(cx: Scope) -> Element {
|
fn app(cx: Scope) -> Element {
|
||||||
cx.render(rsx!({ () }))
|
cx.render(rsx!({}))
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut vdom = VirtualDom::new(app);
|
let mut vdom = VirtualDom::new(app);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ fn test_memory_leak() {
|
|||||||
cx.spawn(async {});
|
cx.spawn(async {});
|
||||||
|
|
||||||
if val == 2 || val == 4 {
|
if val == 2 || val == 4 {
|
||||||
return render!({ () });
|
return render!({});
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = cx.use_hook(|| String::from("numbers: "));
|
let name = cx.use_hook(|| String::from("numbers: "));
|
||||||
|
|||||||
@@ -53,20 +53,15 @@ impl Parse for Component {
|
|||||||
if content.peek(Token![..]) {
|
if content.peek(Token![..]) {
|
||||||
content.parse::<Token![..]>()?;
|
content.parse::<Token![..]>()?;
|
||||||
manual_props = Some(content.parse()?);
|
manual_props = Some(content.parse()?);
|
||||||
} else
|
} else if
|
||||||
//
|
|
||||||
// Fields
|
|
||||||
// Named fields
|
// Named fields
|
||||||
if content.peek(Ident) && content.peek2(Token![:]) && !content.peek3(Token![:]) {
|
(content.peek(Ident) && content.peek2(Token![:]) && !content.peek3(Token![:]))
|
||||||
fields.push(content.parse()?);
|
|
||||||
} else
|
|
||||||
//
|
|
||||||
// shorthand struct initialization
|
// shorthand struct initialization
|
||||||
// Not a div {}, mod::Component {}, or web-component {}
|
// Not a div {}, mod::Component {}, or web-component {}
|
||||||
if content.peek(Ident)
|
|| (content.peek(Ident)
|
||||||
&& !content.peek2(Brace)
|
&& !content.peek2(Brace)
|
||||||
&& !content.peek2(Token![:])
|
&& !content.peek2(Token![:])
|
||||||
&& !content.peek2(Token![-])
|
&& !content.peek2(Token![-]))
|
||||||
{
|
{
|
||||||
fields.push(content.parse()?);
|
fields.push(content.parse()?);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ fn fragments() {
|
|||||||
dioxus_ssr::render_lazy(rsx! {
|
dioxus_ssr::render_lazy(rsx! {
|
||||||
div {
|
div {
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
{()}
|
{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in new issue
Block a user