Skip to content

Commit

Permalink
lots of clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherBiscardi committed Feb 27, 2024
1 parent 47d8098 commit 5677d5e
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 161 deletions.
84 changes: 0 additions & 84 deletions src/app/routes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::app::components::Container;
use leptos::*;
pub mod admin;
pub mod custom;
Expand Down Expand Up @@ -30,86 +29,3 @@ fn PlayIcon(
</svg>
}
}

#[component]
fn EpisodeEntry(episode: Episode) -> impl IntoView {
view! {
<article aria-labelledby=format!("episode-{}-title", episode.id) class="py-10 sm:py-12">
<Container>
<div class="flex flex-col items-start">
<h2
id=format!("episode-{}-title", episode.id)
class="mt-2 text-lg font-bold text-slate-900"
>
<a href=format!("/{}", episode.id)>{&episode.title}</a>
</h2>
// <FormattedDate
// date={date}
// class="order-first font-mono text-sm leading-7 text-slate-500"
// />
<p class="mt-1 text-base leading-7 text-slate-700">{episode.description}</p>
<div class="mt-4 flex items-center gap-4">
// <EpisodePlayButton
// episode={episode}
// class="flex items-center gap-x-3 text-sm font-bold leading-6 text-pink-500 hover:text-pink-700 active:text-pink-900"
// playing={
// <>
// <PauseIcon class="h-2.5 w-2.5 fill-current" />
// <span aria-hidden="true">Listen</span>
// </>
// }
// paused={
// <>
// <PlayIcon class="h-2.5 w-2.5 fill-current" />
// <span aria-hidden="true">Listen</span>
// </>
// }
// />
<span aria-hidden="true" class="text-sm font-bold text-slate-400">
/
</span>
<a
href=format!("/{}", episode.id)
class="flex items-center text-sm font-bold leading-6 text-pink-500 hover:text-pink-700 active:text-pink-900"
aria-label=format!("Show notes for episode {}", episode.title)
>
Show notes
</a>
</div>
</div>
</Container>
</article>
}
}

#[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! {
<div class="pb-12 pt-16 sm:pb-4 lg:pt-12">
<Container>
<h1 class="text-2xl font-bold leading-7 text-slate-900">Episodes</h1>
</Container>
<div class="divide-y divide-slate-100 sm:mt-4 lg:mt-8 lg:border-t lg:border-slate-100">
{episodes
.into_iter()
.map(|episode| view! { <EpisodeEntry episode=episode/> })
.collect::<Vec<_>>()}
</div>
</div>
}
}

struct Episode {
id: String,
published: String,
title: String,
description: String,
}
8 changes: 4 additions & 4 deletions src/app/routes/admin/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn Issue() -> impl IntoView {
}>
{move || {
issue
.read()
.get()
.map(|data| match data {
Err(e) => view! { <pre>{e.to_string()}</pre> }.into_view(),
Ok(issue) => {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -133,7 +133,7 @@ pub async fn update_issue_metadata(
let pool = use_context::<sqlx::MySqlPool>()
.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::<rusty_ulid::Ulid>()
Expand Down Expand Up @@ -304,7 +304,7 @@ fn Showcases() -> impl IntoView {
}>
{move || {
showcases
.read()
.get()
.map(|data| match data {
Err(e) => view! { <pre>{e.to_string()}</pre> }.into_view(),
Ok(showcases) => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/routes/admin/issues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn Issues() -> impl IntoView {
<ul role="list" class="divide-y divide-gray-100">
{move || {
issues
.read()
.get()
.map(|data| match data {
Err(e) => view! { <pre>{e.to_string()}</pre> }.into_view(),
Ok(issues) => {
Expand Down Expand Up @@ -123,7 +123,7 @@ impl From<SqlIssueShort> for IssueShort {
pub async fn fetch_issues(
) -> Result<Vec<IssueShort>, ServerFnError> {
let pool = crate::sql::pool()?;
let username = crate::sql::with_admin_access()?;
let _username = crate::sql::with_admin_access()?;

let issues: Vec<SqlIssueShort> = sqlx::query_as!(
SqlIssueShort,
Expand All @@ -146,7 +146,7 @@ pub async fn create_draft_issue(
) -> Result<(), ServerFnError> {
let pool = use_context::<sqlx::MySqlPool>()
.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/

Expand Down
21 changes: 11 additions & 10 deletions src/app/routes/admin/showcase/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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::<rusty_ulid::Ulid>()
.map_err(|_| {
ServerFnError::<NoCustomError>::ServerError(
Expand Down Expand Up @@ -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<time::Date>,
pub discord_url: String,
pub description: String,
pub images: Vec<ImgDataTransformed>,
id: String,
title: String,
url: String,
posted_date: Option<time::Date>,
discord_url: String,
description: String,
images: Vec<ImgDataTransformed>,
}

#[derive(Debug, Deserialize, Serialize, Clone)]
Expand Down Expand Up @@ -650,7 +651,7 @@ limit 5"#
)
.fetch_all(&pool)
.await
.map_err(|e| {
.map_err(|_| {
ServerFnError::<NoCustomError>::ServerError(
"sql failed".to_string(),
)
Expand Down
23 changes: 14 additions & 9 deletions src/app/routes/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Showcase>,
showcases: Vec<Showcase>,
/// Crates that have been released in the last
/// week. This includes updates and new
/// releases
pub crates: Vec<CrateRelease>,
crates: Vec<CrateRelease>,
/// merged pull requests
/// Meant to convey what is being added to
/// Bevy
pub pull_requests: Vec<PullRequest>,
pull_requests: Vec<PullRequest>,
/// educational resources published this week.
/// videos and blog posts
pub educational: Vec<Educational>,
educational: Vec<Educational>,
/// 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<Contributor>,
contributors: Vec<Contributor>,
/// Want to contribute? check out these
/// pull requests that need review
pub new_pull_requests: Vec<NewPullRequest>,
new_pull_requests: Vec<NewPullRequest>,
/// Want to contribute? check out these
/// issues that just got opened
pub new_issues: Vec<NewIssue>,
new_issues: Vec<NewIssue>,
}

/// `NewPullRequest` is calculated just before
Expand Down Expand Up @@ -351,6 +351,7 @@ pub fn Issue() -> impl IntoView {
}
}

#[allow(dead_code)]
enum ActivityListIcon {
Default,
Check,
Expand Down Expand Up @@ -416,6 +417,7 @@ fn ActivityListItem(
}
}
#[component]
#[allow(unused_variables)]
fn ActivityListComment(
/// datetime for the <time> element
/// "2023-01-23T15:56"
Expand Down Expand Up @@ -457,6 +459,7 @@ fn ActivityListComment(
}

#[component]
#[allow(unused_variables)]
fn CrateRelease(
#[prop(into)] title: String,
#[prop(into)] description: String,
Expand Down Expand Up @@ -498,6 +501,7 @@ fn CrateRelease(
}
}

#[allow(dead_code)]
enum CalloutType {
Info,
Caution,
Expand Down Expand Up @@ -607,6 +611,7 @@ impl CalloutType {
}
}

#[allow(dead_code)]
struct CalloutLink {
href: String,
label: String,
Expand Down
Loading

0 comments on commit 5677d5e

Please sign in to comment.