-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Context
The PageLike trait's short_title() method returns Option<&str>, requiring every call site to manually fall back to title() via .unwrap_or().
Current behavior
Every call site already applies the same pattern:
crates/rari-doc/src/helpers/title.rs:68—root_doc.short_title().unwrap_or(root_doc.title())crates/rari-doc/src/helpers/subpages.rs:27-28— sorting uses.unwrap_or(a.title())crates/rari-doc/src/html/links.rs:78— link rendering uses.unwrap_or(page.title())
Proposal
Add a default method to the PageLike trait (or equivalent) that encapsulates this fallback, reducing repetition and preventing inconsistencies:
fn short_title_or_title(&self) -> &str {
self.short_title().unwrap_or(self.title())
}This is a low-priority cleanup item — the current approach works correctly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels