From 5677d5ed6bf371f6370edcd593f96f369122e968 Mon Sep 17 00:00:00 2001 From: Christopher Biscardi Date: Mon, 26 Feb 2024 23:54:55 -0800 Subject: [PATCH] lots of clippy fixes --- src/app/routes.rs | 84 ----------------------------- src/app/routes/admin/issue.rs | 8 +-- src/app/routes/admin/issues.rs | 6 +-- src/app/routes/admin/showcase/id.rs | 21 ++++---- src/app/routes/custom.rs | 23 ++++---- src/app/routes/issue.rs | 62 +++++++-------------- src/lib.rs | 2 +- src/sql.rs | 2 + src/users.rs | 6 --- 9 files changed, 53 insertions(+), 161 deletions(-) diff --git a/src/app/routes.rs b/src/app/routes.rs index e9a2201..61f0177 100644 --- a/src/app/routes.rs +++ b/src/app/routes.rs @@ -1,4 +1,3 @@ -use crate::app::components::Container; use leptos::*; pub mod admin; pub mod custom; @@ -30,86 +29,3 @@ fn PlayIcon( } } - -#[component] -fn EpisodeEntry(episode: Episode) -> impl IntoView { - view! { -
- -
-

- {&episode.title} -

- // -

{episode.description}

-
- // - // - // - // - // } - // paused={ - // <> - // - // - // - // } - // /> - - - Show notes - -
-
-
-
- } -} - -#[component] -pub fn Home() -> impl IntoView { - // let episodes = await getAllEpisodes() - let episodes = vec![Episode { - id: "test data".to_string(), - published: "test data".to_string(), - title: "test data".to_string(), - description: "test data".to_string(), - }]; - - view! { -
- -

Episodes

-
-
- {episodes - .into_iter() - .map(|episode| view! { }) - .collect::>()} -
-
- } -} - -struct Episode { - id: String, - published: String, - title: String, - description: String, -} diff --git a/src/app/routes/admin/issue.rs b/src/app/routes/admin/issue.rs index be05ce8..84f6f10 100644 --- a/src/app/routes/admin/issue.rs +++ b/src/app/routes/admin/issue.rs @@ -21,7 +21,7 @@ pub fn Issue() -> impl IntoView { }> {move || { issue - .read() + .get() .map(|data| match data { Err(e) => view! {
{e.to_string()}
}.into_view(), Ok(issue) => { @@ -98,7 +98,7 @@ pub async fn fetch_issue( .into(); let pool = crate::sql::pool()?; - let username = crate::sql::with_admin_access()?; + let _username = crate::sql::with_admin_access()?; let issue = sqlx::query_as!( SqlIssueData, @@ -133,7 +133,7 @@ pub async fn update_issue_metadata( let pool = use_context::() .expect("to be able to access app_state"); - let username = crate::sql::with_admin_access()?; + let _username = crate::sql::with_admin_access()?; let id: [u8; 16] = issue_id .parse::() @@ -304,7 +304,7 @@ fn Showcases() -> impl IntoView { }> {move || { showcases - .read() + .get() .map(|data| match data { Err(e) => view! {
{e.to_string()}
}.into_view(), Ok(showcases) => { diff --git a/src/app/routes/admin/issues.rs b/src/app/routes/admin/issues.rs index c9c30c8..4821418 100644 --- a/src/app/routes/admin/issues.rs +++ b/src/app/routes/admin/issues.rs @@ -45,7 +45,7 @@ pub fn Issues() -> impl IntoView {
    {move || { issues - .read() + .get() .map(|data| match data { Err(e) => view! {
    {e.to_string()}
    }.into_view(), Ok(issues) => { @@ -123,7 +123,7 @@ impl From for IssueShort { pub async fn fetch_issues( ) -> Result, ServerFnError> { let pool = crate::sql::pool()?; - let username = crate::sql::with_admin_access()?; + let _username = crate::sql::with_admin_access()?; let issues: Vec = sqlx::query_as!( SqlIssueShort, @@ -146,7 +146,7 @@ pub async fn create_draft_issue( ) -> Result<(), ServerFnError> { let pool = use_context::() .expect("to be able to access app_state"); - let username = crate::sql::with_admin_access()?; + let _username = crate::sql::with_admin_access()?; // https://res.cloudinary.com/dilgcuzda/image/upload/v1708310121/ diff --git a/src/app/routes/admin/showcase/id.rs b/src/app/routes/admin/showcase/id.rs index c080ee5..109ba7b 100644 --- a/src/app/routes/admin/showcase/id.rs +++ b/src/app/routes/admin/showcase/id.rs @@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize}; use crate::app::server_fn::error::NoCustomError; #[server] +#[allow(unused_variables)] async fn update_showcase( showcase_id: String, title: String, @@ -15,10 +16,10 @@ async fn update_showcase( description: String, posted_date: String, ) -> Result<(), ServerFnError> { - let pool = crate::sql::pool()?; + let _pool = crate::sql::pool()?; let _username = crate::sql::with_admin_access()?; - let id: [u8; 16] = showcase_id + let _id: [u8; 16] = showcase_id .parse::() .map_err(|_| { ServerFnError::::ServerError( @@ -234,13 +235,13 @@ struct SqlShowcaseData { #[derive(Deserialize, Serialize, Clone)] pub struct ShowcaseData { - pub id: String, - pub title: String, - pub url: String, - pub posted_date: Option, - pub discord_url: String, - pub description: String, - pub images: Vec, + id: String, + title: String, + url: String, + posted_date: Option, + discord_url: String, + description: String, + images: Vec, } #[derive(Debug, Deserialize, Serialize, Clone)] @@ -650,7 +651,7 @@ limit 5"# ) .fetch_all(&pool) .await - .map_err(|e| { + .map_err(|_| { ServerFnError::::ServerError( "sql failed".to_string(), ) diff --git a/src/app/routes/custom.rs b/src/app/routes/custom.rs index c44b0c0..439778d 100644 --- a/src/app/routes/custom.rs +++ b/src/app/routes/custom.rs @@ -12,38 +12,38 @@ pub struct Issue { /// date in yyyy-mm-dd format, but this field /// is a human-readable string that goes in /// the email subject line and slug url - pub title: String, + title: String, /// What is this issue about? Is there /// anything notable worth mentioning or /// making sure people are aware of? - pub description: String, + description: String, /// Showcase what people are doing with Bevy /// this week. Often these are in-progress /// games, experimental rendering approaches, /// or other in-progress bevy work - pub showcases: Vec, + showcases: Vec, /// Crates that have been released in the last /// week. This includes updates and new /// releases - pub crates: Vec, + crates: Vec, /// merged pull requests /// Meant to convey what is being added to /// Bevy - pub pull_requests: Vec, + pull_requests: Vec, /// educational resources published this week. /// videos and blog posts - pub educational: Vec, + educational: Vec, /// newsletter contributors /// (not a list of people that contribute to /// the bevy repo itself, that exists in the /// Bevy release announcements already) - pub contributors: Vec, + contributors: Vec, /// Want to contribute? check out these /// pull requests that need review - pub new_pull_requests: Vec, + new_pull_requests: Vec, /// Want to contribute? check out these /// issues that just got opened - pub new_issues: Vec, + new_issues: Vec, } /// `NewPullRequest` is calculated just before @@ -351,6 +351,7 @@ pub fn Issue() -> impl IntoView { } } +#[allow(dead_code)] enum ActivityListIcon { Default, Check, @@ -416,6 +417,7 @@ fn ActivityListItem( } } #[component] +#[allow(unused_variables)] fn ActivityListComment( /// datetime for the