Clear warnings in router example

This commit is contained in:
Greg Johnston 2022-12-19 07:41:50 -05:00
parent 557bd25e2c
commit c63c8728a7
3 changed files with 6 additions and 8 deletions

View file

@ -92,11 +92,11 @@ pub fn Comment(cx: Scope, comment: api::Comment) -> impl IntoView {
let comments = comment.comments.clone();
move || view! { cx,
<ul class="comment-children">
<For
/* <For
each=move || comments.clone()
key=|comment| comment.id
view=move |comment: api::Comment| view! { cx, <Comment comment /> }
/>
/> */
</ul>
}
})}

View file

@ -27,9 +27,9 @@ pub struct Contact {
pub phone: String,
}
pub async fn get_contacts(search: String) -> Vec<ContactSummary> {
pub async fn get_contacts(_search: String) -> Vec<ContactSummary> {
// fake an API call with an artificial delay
delay(Duration::from_millis(300)).await;
_ = delay(Duration::from_millis(300)).await;
vec![
ContactSummary {
id: 0,
@ -51,7 +51,7 @@ pub async fn get_contacts(search: String) -> Vec<ContactSummary> {
pub async fn get_contact(id: Option<usize>) -> Option<Contact> {
// fake an API call with an artificial delay
delay(Duration::from_millis(500)).await;
_ = delay(Duration::from_millis(500)).await;
match id {
Some(0) => Some(Contact {
id: 0,
@ -97,7 +97,7 @@ fn delay(duration: Duration) -> impl Future<Output = Result<(), Canceled>> {
let (tx, rx) = oneshot::channel();
set_timeout(
move || {
tx.send(());
_ = tx.send(());
},
duration,
);

View file

@ -1,8 +1,6 @@
mod api;
use api::{Contact, ContactSummary};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
use crate::api::{get_contact, get_contacts};