From de5d8d5f8679d64fb0f65d26ee36013429b1e1a9 Mon Sep 17 00:00:00 2001 From: gmnsii Date: Sun, 26 Mar 2023 11:52:02 -0700 Subject: [PATCH] Requested code style changes --- src/post.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/post.rs b/src/post.rs index 12b4a6f..91af91e 100644 --- a/src/post.rs +++ b/src/post.rs @@ -104,7 +104,7 @@ pub async fn item(req: Request) -> Result, String> { } } -/* COMMENTS */ +// COMMENTS fn parse_comments(json: &serde_json::Value, post_link: &str, post_author: &str, highlighted_comment: &str, filters: &HashSet, req: &Request) -> Vec { // Parse the comment JSON into a Vector of Comments @@ -118,7 +118,7 @@ fn parse_comments(json: &serde_json::Value, post_link: &str, post_author: &str, let replies: Vec = if data["replies"].is_object() { parse_comments(&data["replies"], post_link, post_author, highlighted_comment, filters, req) } else { - Vec::with_capacity(0) + Vec::new() }; build_comment(&comment, data, replies, post_link, post_author, highlighted_comment, filters, req) }) @@ -145,7 +145,7 @@ fn query_comments( results.append(&mut query_comments(&data["replies"], post_link, post_author, highlighted_comment, filters, query, req)) } - let c = build_comment(&comment, data, Vec::with_capacity(0), post_link, post_author, highlighted_comment, filters, req); + let c = build_comment(&comment, data, Vec::new(), post_link, post_author, highlighted_comment, filters, req); if c.body.to_lowercase().contains(&query.to_lowercase()) { results.push(c); }