Skip to content

Commit

Permalink
Fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Mar 30, 2024
1 parent f4c48a1 commit 21e4355
Show file tree
Hide file tree
Showing 30 changed files with 211 additions and 376 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

14 changes: 6 additions & 8 deletions src/auth/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ pub async fn filter_enlisted_projects_ids(
.collect::<Vec<_>>(),
user_id as database::models::ids::UserId,
)
.fetch_many(pool)
.try_for_each(|e| {
if let Some(row) = e.right() {
for x in projects.iter() {
let bool = Some(x.id.0) == row.id && Some(x.team_id.0) == row.team_id;
if bool {
return_projects.push(x.id);
}
.fetch(pool)
.try_for_each(|row| {
for x in projects.iter() {
let bool = Some(x.id.0) == row.id && Some(x.team_id.0) == row.team_id;
if bool {
return_projects.push(x.id);
}
}

Expand Down
20 changes: 10 additions & 10 deletions src/database/models/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ impl Category {
ORDER BY c.ordering, c.category
"
)
.fetch_many(exec)
.try_filter_map(|e| async {
Ok(e.right().map(|c| Category {
.fetch(exec)
.try_filter_map(|c| async {
Ok(Some(Category {
id: CategoryId(c.id),
category: c.category,
project_type: c.project_type,
Expand Down Expand Up @@ -166,9 +166,9 @@ impl LinkPlatform {
SELECT id, name, donation FROM link_platforms
"
)
.fetch_many(exec)
.try_filter_map(|e| async {
Ok(e.right().map(|c| LinkPlatform {
.fetch(exec)
.try_filter_map(|c| async {
Ok(Some(LinkPlatform {
id: LinkPlatformId(c.id),
name: c.name,
donation: c.donation,
Expand Down Expand Up @@ -222,8 +222,8 @@ impl ReportType {
SELECT name FROM report_types
"
)
.fetch_many(exec)
.try_filter_map(|e| async { Ok(e.right().map(|c| c.name)) })
.fetch(exec)
.try_filter_map(|e| async { Ok(Some(e.name)) })
.try_collect::<Vec<String>>()
.await?;

Expand Down Expand Up @@ -272,8 +272,8 @@ impl ProjectType {
SELECT name FROM project_types
"
)
.fetch_many(exec)
.try_filter_map(|e| async { Ok(e.right().map(|c| c.name)) })
.fetch(exec)
.try_filter_map(|c| async { Ok(Some(c.name)) })
.try_collect::<Vec<String>>()
.await?;

Expand Down
10 changes: 5 additions & 5 deletions src/database/models/image_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ impl Image {
report_id.map(|x| x.0),

)
.fetch_many(&mut **transaction)
.try_filter_map(|e| async {
Ok(e.right().map(|row| {
let id = ImageId(row.id);
.fetch(&mut **transaction)
.try_filter_map(|row| async {
let id = ImageId(row.id);

Ok(Some(
Image {
id,
url: row.url,
Expand All @@ -152,7 +152,7 @@ impl Image {
thread_message_id: row.thread_message_id.map(ThreadMessageId),
report_id: row.report_id.map(ReportId),
}
}))
))
})
.try_collect::<Vec<Image>>()
.await
Expand Down
28 changes: 15 additions & 13 deletions src/database/models/loader_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ impl Game {
SELECT id, slug, name, icon_url, banner_url FROM games
",
)
.fetch_many(exec)
.try_filter_map(|e| async {
Ok(e.right().map(|x| Game {
.fetch(exec)
.try_filter_map(|x| async {
Ok(Some(Game {
id: GameId(x.id),
slug: x.slug,
name: x.name,
Expand Down Expand Up @@ -151,9 +151,9 @@ impl Loader {
GROUP BY l.id;
",
)
.fetch_many(exec)
.try_filter_map(|e| async {
Ok(e.right().map(|x| Loader {
.fetch(exec)
.try_filter_map(|x| async {
Ok(Some(Loader {
id: LoaderId(x.id),
loader: x.loader,
icon: x.icon,
Expand Down Expand Up @@ -451,18 +451,20 @@ impl LoaderField {
FROM loader_fields lf
",
)
.fetch_many(exec)
.try_filter_map(|e| async {
Ok(e.right().and_then(|r| {
Some(LoaderField {
.fetch(exec)
.try_filter_map(|r| async {
if let Some(field_type) = LoaderFieldType::build(&r.field_type, r.enum_type) {
Ok(Some(LoaderField {
id: LoaderFieldId(r.id),
field_type: LoaderFieldType::build(&r.field_type, r.enum_type)?,
field_type,
field: r.field,
optional: r.optional,
min_val: r.min_val,
max_val: r.max_val,
})
}))
}))
} else {
Ok(None)
}
})
.try_collect::<Vec<LoaderField>>()
.await?;
Expand Down

0 comments on commit 21e4355

Please sign in to comment.