diff options
Diffstat (limited to '')
-rw-r--r-- | sys/nixpkgs/pkgs/comments/src/info_json.rs | 6 | ||||
-rw-r--r-- | sys/nixpkgs/pkgs/comments/src/main.rs | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/nixpkgs/pkgs/comments/src/info_json.rs b/sys/nixpkgs/pkgs/comments/src/info_json.rs index e479c320..70eae738 100644 --- a/sys/nixpkgs/pkgs/comments/src/info_json.rs +++ b/sys/nixpkgs/pkgs/comments/src/info_json.rs @@ -92,7 +92,7 @@ pub enum Parent { impl Parent { pub fn id(&self) -> Option<&str> { if let Self::Id(id) = self { - Some(&id) + Some(id) } else { None } @@ -130,6 +130,7 @@ pub struct Comment { #[serde(default = "zero")] pub like_count: u32, pub author_id: String, + #[serde(default = "unknown")] pub author: String, pub author_thumbnail: String, pub parent: Parent, @@ -142,6 +143,9 @@ pub struct Comment { pub author_is_uploader: bool, pub is_favorited: bool, } +fn unknown() -> String { + "<Unknown>".to_string() +} fn zero() -> u32 { 0 } diff --git a/sys/nixpkgs/pkgs/comments/src/main.rs b/sys/nixpkgs/pkgs/comments/src/main.rs index 12a89b7e..6e4f72e9 100644 --- a/sys/nixpkgs/pkgs/comments/src/main.rs +++ b/sys/nixpkgs/pkgs/comments/src/main.rs @@ -100,7 +100,7 @@ impl Display for Comments { let ident = &(0..ident_count).map(|_| " ").collect::<String>(); let value = &comment.value; - f.write_str(&ident)?; + f.write_str(ident)?; if value.author_is_uploader { c!("91;1", f); @@ -143,7 +143,7 @@ impl Display for Comments { // c!("0", f); f.write_str(":\n")?; - f.write_str(&ident)?; + f.write_str(ident)?; f.write_str(&value.text.replace('\n', &format!("\n{}", ident)))?; f.write_str("\n")?; @@ -220,7 +220,7 @@ fn main() -> anyhow::Result<()> { &reply .value .text[full_match.end()..]; - let text: &str = &text.trim().trim_matches('\u{200b}'); + let text: &str = text.trim().trim_matches('\u{200b}'); let replyee = replyee_match.get(1).expect("This should exist").as_str(); |