server: clear clippy gate (from_db_str rename, create_item allow)
ScanTargetKind::from_str renamed to from_db_str so it no longer shadows the FromStr trait (returns Option, not Result); create_item gets an explicit too_many_arguments allow (house pattern).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+8 insertions,
-4 deletions
| 91 |
91 |
|
Ok(item)
|
| 92 |
92 |
|
}
|
| 93 |
93 |
|
|
|
94 |
+ |
#[allow(clippy::too_many_arguments)]
|
| 94 |
95 |
|
pub async fn create_item(
|
| 95 |
96 |
|
pool: &PgPool,
|
| 96 |
97 |
|
project_id: ProjectId,
|
| 47 |
47 |
|
}
|
| 48 |
48 |
|
}
|
| 49 |
49 |
|
|
| 50 |
|
- |
pub fn from_str(s: &str) -> Option<Self> {
|
|
50 |
+ |
/// Decode the DB `target_kind` text. Named `from_db_str` (not `from_str`) so
|
|
51 |
+ |
/// it doesn't shadow the `FromStr` trait method — it returns `Option`, not the
|
|
52 |
+ |
/// `Result` that trait requires, and pairs with `as_str` above.
|
|
53 |
+ |
pub fn from_db_str(s: &str) -> Option<Self> {
|
| 51 |
54 |
|
Some(match s {
|
| 52 |
55 |
|
"item" => ScanTargetKind::Item,
|
| 53 |
56 |
|
"version" => ScanTargetKind::Version,
|
| 130 |
133 |
|
|
| 131 |
134 |
|
impl ScanJob {
|
| 132 |
135 |
|
pub fn typed_kind(&self) -> Option<ScanTargetKind> {
|
| 133 |
|
- |
ScanTargetKind::from_str(&self.target_kind)
|
|
136 |
+ |
ScanTargetKind::from_db_str(&self.target_kind)
|
| 134 |
137 |
|
}
|
| 135 |
138 |
|
|
| 136 |
139 |
|
pub fn typed_file_type(&self) -> Option<FileType> {
|
| 435 |
438 |
|
ScanTargetKind::GalleryImage,
|
| 436 |
439 |
|
ScanTargetKind::ContentInsertion,
|
| 437 |
440 |
|
] {
|
| 438 |
|
- |
assert_eq!(ScanTargetKind::from_str(kind.as_str()), Some(kind));
|
|
441 |
+ |
assert_eq!(ScanTargetKind::from_db_str(kind.as_str()), Some(kind));
|
| 439 |
442 |
|
}
|
| 440 |
|
- |
assert_eq!(ScanTargetKind::from_str("bogus"), None);
|
|
443 |
+ |
assert_eq!(ScanTargetKind::from_db_str("bogus"), None);
|
| 441 |
444 |
|
}
|
| 442 |
445 |
|
|
| 443 |
446 |
|
#[test]
|