domain: Slug::from_title is dead code duplicating Title::to_slug #69

Open
opened 2026-07-03 01:43:18 +00:00 by rosa · 0 comments
Owner

Found during a code review of the domain crate.

Location: crates/domain/src/models/post.rs:141 (Slug::from_title) vs post.rs:58 (Title::to_slug)
Type: Cleanup — dead code / duplication

Problem

Slug::from_title and Title::to_slug are both one-line wrappers around Slug::parse(title.as_str()), and only to_slug has callers. A workspace-wide grep finds zero callers of from_title.

Cost

Two names for the same conversion invite drift and force readers to check whether they differ.

Suggested fix

Delete Slug::from_title and keep Title::to_slug as the single conversion.

Found during a code review of the `domain` crate. **Location:** `crates/domain/src/models/post.rs:141` (`Slug::from_title`) vs `post.rs:58` (`Title::to_slug`) **Type:** Cleanup — dead code / duplication ## Problem `Slug::from_title` and `Title::to_slug` are both one-line wrappers around `Slug::parse(title.as_str())`, and only `to_slug` has callers. A workspace-wide grep finds zero callers of `from_title`. ## Cost Two names for the same conversion invite drift and force readers to check whether they differ. ## Suggested fix Delete `Slug::from_title` and keep `Title::to_slug` as the single conversion.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rosa/vernier#69
No description provided.