From 0f6e73dd876c980fa695ffc2185468a5f4e3546b Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Sat, 16 Jan 2021 11:50:12 -0800 Subject: [PATCH] Reformat code --- src/post.rs | 8 +++++--- src/utils.rs | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/post.rs b/src/post.rs index 7fd66ec..b4d577b 100644 --- a/src/post.rs +++ b/src/post.rs @@ -1,5 +1,5 @@ // CRATES -use crate::utils::{Comment, Flags, Flair, Post, Preferences, cookie, error, format_num, format_url, media, param, parse_rich_flair, prefs, request, rewrite_url, time, val}; +use crate::utils::{cookie, error, format_num, format_url, media, param, parse_rich_flair, prefs, request, rewrite_url, time, val, Comment, Flags, Flair, Post, Preferences}; use actix_web::{HttpRequest, HttpResponse}; use async_recursion::async_recursion; @@ -115,7 +115,7 @@ async fn parse_post(json: &serde_json::Value) -> Post { media, domain: val(post, "domain"), rel_time, - created + created, } } @@ -133,7 +133,9 @@ async fn parse_comments(json: &serde_json::Value) -> Vec { // For each comment, retrieve the values to build a Comment object for comment in comment_data { let unix_time = comment["data"]["created_utc"].as_f64().unwrap_or_default(); - if unix_time == 0.0 { continue } + if unix_time == 0.0 { + continue; + } let (rel_time, created) = time(unix_time); let score = comment["data"]["score"].as_i64().unwrap_or(0); diff --git a/src/utils.rs b/src/utils.rs index 4005a33..1538c5a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -343,7 +343,7 @@ pub async fn fetch_posts(path: &str, fallback_title: String) -> Result<(Vec