examples/hackernews - Cargo clippy fixes.

This commit is contained in:
Martin 2023-01-08 13:33:53 +00:00
parent 4cacfe98d8
commit ef52a01838
4 changed files with 6 additions and 8 deletions

View File

@ -1,5 +1,4 @@
use cfg_if::cfg_if;
use leptos::*;
// boilerplate to run in different modes
cfg_if! {

View File

@ -48,12 +48,12 @@ pub fn Stories(cx: Scope) -> impl IntoView {
{move || if page() > 1 {
view! {
cx,
<a class="page-link"
<html::a class="page-link"
href=move || format!("/{}?page={}", story_type(), page() - 1)
attr:aria_label="Previous Page"
>
"< prev"
</a>
</html::a>
}.into_any()
} else {
view! {
@ -134,7 +134,7 @@ fn Story(cx: Scope, story: api::Story) -> impl IntoView {
view! { cx,
<span>
{"by "}
{story.user.map(|user| view ! { cx, <A href=format!("/users/{}", user)>{user.clone()}</A>})}
{story.user.map(|user| view ! { cx, <A href=format!("/users/{user}")>{user.clone()}</A>})}
{format!(" {} | ", story.time_ago)}
<A href=format!("/stories/{}", story.id)>
{if story.comments_count.unwrap_or_default() > 0 {

View File

@ -17,7 +17,7 @@ pub fn Story(cx: Scope) -> impl IntoView {
}
},
);
let meta_description = move || story.read().and_then(|story| story.map(|story| story.title.clone())).unwrap_or_else(|| "Loading story...".to_string());
let meta_description = move || story.read().and_then(|story| story.map(|story| story.title)).unwrap_or_else(|| "Loading story...".to_string());
view! { cx,
<>
@ -37,7 +37,7 @@ pub fn Story(cx: Scope) -> impl IntoView {
{story.user.map(|user| view! { cx, <p class="meta">
{story.points}
" points | by "
<A href=format!("/users/{}", user)>{user.clone()}</A>
<A href=format!("/users/{user}")>{user.clone()}</A>
{format!(" {}", story.time_ago)}
</p>})}
</div>

View File

@ -188,8 +188,7 @@ mod struct_info {
Some(ref doc) => quote!(#[doc = #doc]),
None => {
let doc = format!(
"Builder for [`{name}`] instances.\n\nSee [`{name}::builder()`] for more info.",
name = name
"Builder for [`{name}`] instances.\n\nSee [`{name}::builder()`] for more info."
);
quote!(#[doc = #doc])
}