Skip to content

Commit 9428f34

Browse files
committed
fix: clippy issues
1 parent ce598b9 commit 9428f34

4 files changed

Lines changed: 11 additions & 29 deletions

File tree

database/src/models/comic.rs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ impl Comic {
142142
)
143143
.fetch_optional(executor)
144144
.await
145-
.map(|i| i.map(|i| i as u16))
146145
}
147146

148147
pub async fn next_id<'e, 'c: 'e, E>(
@@ -171,7 +170,6 @@ impl Comic {
171170
)
172171
.fetch_optional(executor)
173172
.await
174-
.map(|i| i.map(|i| i as u16))
175173
}
176174

177175
pub async fn publish_date_by_id<'e, 'c: 'e, E>(
@@ -398,11 +396,7 @@ impl Comic {
398396
)
399397
.fetch_optional(executor)
400398
.await
401-
.map(|ofl| {
402-
ofl.map_or((None, None), |fl| {
403-
(fl.first.map(|i| i as u16), fl.last.map(|i| i as u16))
404-
})
405-
})
399+
.map(|ofl| ofl.map_or((None, None), |fl| (fl.first, fl.last)))
406400
}
407401

408402
pub async fn previous_missing_tagline_by_id<'e, 'c: 'e, E>(
@@ -427,7 +421,6 @@ impl Comic {
427421
)
428422
.fetch_optional(executor)
429423
.await
430-
.map(|i| i.map(|i| i as u16))
431424
}
432425

433426
pub async fn next_missing_tagline_by_id<'e, 'c: 'e, E>(
@@ -452,7 +445,6 @@ impl Comic {
452445
)
453446
.fetch_optional(executor)
454447
.await
455-
.map(|i| i.map(|i| i as u16))
456448
}
457449

458450
// ---
@@ -476,11 +468,7 @@ impl Comic {
476468
)
477469
.fetch_optional(executor)
478470
.await
479-
.map(|ofl| {
480-
ofl.map_or((None, None), |fl| {
481-
(fl.first.map(|i| i as u16), fl.last.map(|i| i as u16))
482-
})
483-
})
471+
.map(|ofl| ofl.map_or((None, None), |fl| (fl.first, fl.last)))
484472
}
485473

486474
pub async fn previous_missing_title_by_id<'e, 'c: 'e, E>(
@@ -504,7 +492,6 @@ impl Comic {
504492
)
505493
.fetch_optional(executor)
506494
.await
507-
.map(|i| i.map(|i| i as u16))
508495
}
509496

510497
pub async fn next_missing_title_by_id<'e, 'c: 'e, E>(
@@ -528,7 +515,6 @@ impl Comic {
528515
)
529516
.fetch_optional(executor)
530517
.await
531-
.map(|i| i.map(|i| i as u16))
532518
}
533519

534520
// ---
@@ -567,7 +553,6 @@ impl Comic {
567553
)
568554
.fetch_optional(executor)
569555
.await
570-
.map(|i| i.map(|i| i as u16))
571556
}
572557

573558
pub async fn previous_missing_items_by_id_and_type<'e, 'c: 'e, E>(
@@ -607,7 +592,6 @@ impl Comic {
607592
)
608593
.fetch_optional(executor)
609594
.await
610-
.map(|i| i.map(|i| i as u16))
611595
}
612596

613597
pub async fn next_missing_items_by_id_and_type<'e, 'c: 'e, E>(
@@ -647,7 +631,6 @@ impl Comic {
647631
)
648632
.fetch_optional(executor)
649633
.await
650-
.map(|i| i.map(|i| i as u16))
651634
}
652635

653636
pub async fn last_missing_items_by_type<'e, 'c: 'e, E>(
@@ -684,7 +667,6 @@ impl Comic {
684667
)
685668
.fetch_optional(executor)
686669
.await
687-
.map(|i| i.map(|i| i as u16))
688670
}
689671

690672
pub async fn tagline_by_id<'e, 'c: 'e, E>(executor: E, id: u16) -> sqlx::Result<Option<String>>

database/src/models/item.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Item {
3434
comic_id,
3535
)
3636
.fetch(executor)
37-
.map_ok(|i| (i.id as u16, i))
37+
.map_ok(|i| (i.id, i))
3838
.try_collect()
3939
.await
4040
}
@@ -66,7 +66,7 @@ impl Item {
6666
"#,
6767
)
6868
.fetch(executor)
69-
.map_ok(|i| (i.id as u16, i))
69+
.map_ok(|i| (i.id, i))
7070
.try_collect()
7171
.await
7272
}
@@ -200,7 +200,7 @@ impl Item {
200200
.fetch(executor)
201201
.try_filter_map(|pn| async move {
202202
if let Some(comic) = pn.comic {
203-
Ok(Some((pn.id as u16, comic as u16)))
203+
Ok(Some((pn.id, comic)))
204204
} else {
205205
Ok(None)
206206
}
@@ -241,7 +241,7 @@ impl Item {
241241
.fetch(executor)
242242
.try_filter_map(|pn| async move {
243243
if let Some(comic) = pn.comic {
244-
Ok(Some((pn.id as u16, comic as u16)))
244+
Ok(Some((pn.id, comic)))
245245
} else {
246246
Ok(None)
247247
}
@@ -326,7 +326,7 @@ impl Item {
326326
.fetch(executor)
327327
.try_filter_map(|pn| async move {
328328
if let Some(comic) = pn.comic {
329-
Ok(Some((pn.id as u16, comic as u16)))
329+
Ok(Some((pn.id, comic)))
330330
} else {
331331
Ok(None)
332332
}
@@ -371,7 +371,7 @@ impl Item {
371371
.fetch(executor)
372372
.try_filter_map(|pn| async move {
373373
if let Some(comic) = pn.comic {
374-
Ok(Some((pn.id as u16, comic as u16)))
374+
Ok(Some((pn.id, comic)))
375375
} else {
376376
Ok(None)
377377
}

src/controllers/releases.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub(crate) async fn get_latest_script_file(file: web::Path<String>) -> Result<Ht
116116
// Cache wasn't expired, but we still had to fetch the asset
117117
// which means it was a cache miss, so add the missing asset
118118
// to the existing cache
119-
let mut new_cache = (&**cache).clone();
119+
let mut new_cache = (**cache).clone();
120120
if script_file == ScriptFile::User {
121121
new_cache.user = Some(asset.clone());
122122
} else {

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ impl<A, B> Either<A, B> {
8484
fn project(self: Pin<&mut Self>) -> Either<Pin<&mut A>, Pin<&mut B>> {
8585
unsafe {
8686
match self.get_unchecked_mut() {
87-
Either::Left(a) => Either::Left(Pin::new_unchecked(a)),
88-
Either::Right(b) => Either::Right(Pin::new_unchecked(b)),
87+
Self::Left(a) => Either::Left(Pin::new_unchecked(a)),
88+
Self::Right(b) => Either::Right(Pin::new_unchecked(b)),
8989
}
9090
}
9191
}

0 commit comments

Comments
 (0)