Skip to main content

max / makenotwork

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>
Author: Max Johnson <me@maxj.phd> · 2026-07-05 15:49 UTC
Commit: aec6aa8ac66c95a69f89b34c97df4d7f8085eac8
Parent: 6c2657e
2 files changed, +8 insertions, -4 deletions
@@ -91,6 +91,7 @@ pub async fn find_untitled_wizard_draft(
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,7 +47,10 @@ impl ScanTargetKind {
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,7 +133,7 @@ pub struct ScanJob {
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,9 +438,9 @@ mod tests {
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]