diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/yt/src/comments/comment.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/crates/yt/src/comments/comment.rs b/crates/yt/src/comments/comment.rs index d9e3036..30b8ea0 100644 --- a/crates/yt/src/comments/comment.rs +++ b/crates/yt/src/comments/comment.rs @@ -15,22 +15,11 @@ use url::Url; #[derive(Debug, Deserialize, Serialize, Clone, Eq, PartialEq, PartialOrd, Ord)] #[serde(from = "String")] #[serde(deny_unknown_fields)] -pub enum Parent { +pub(crate) enum Parent { Root, Id(String), } -impl Parent { - #[must_use] - pub fn id(&self) -> Option<&str> { - if let Self::Id(id) = self { - Some(id) - } else { - None - } - } -} - impl From<String> for Parent { fn from(value: String) -> Self { if value == "root" { @@ -51,7 +40,7 @@ impl From<String> for Id { fn from(value: String) -> Self { Self { // Take the last element if the string is split with dots, otherwise take the full id - id: value.split('.').last().unwrap_or(&value).to_owned(), + id: value.split('.').next_back().unwrap_or(&value).to_owned(), } } } |