Reformat code

This commit is contained in:
spikecodes 2021-01-16 11:50:12 -08:00
parent 151490faf0
commit 0f6e73dd87
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
// CRATES // 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 actix_web::{HttpRequest, HttpResponse};
use async_recursion::async_recursion; use async_recursion::async_recursion;
@ -115,7 +115,7 @@ async fn parse_post(json: &serde_json::Value) -> Post {
media, media,
domain: val(post, "domain"), domain: val(post, "domain"),
rel_time, rel_time,
created created,
} }
} }
@ -133,7 +133,9 @@ async fn parse_comments(json: &serde_json::Value) -> Vec<Comment> {
// For each comment, retrieve the values to build a Comment object // For each comment, retrieve the values to build a Comment object
for comment in comment_data { for comment in comment_data {
let unix_time = comment["data"]["created_utc"].as_f64().unwrap_or_default(); 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 (rel_time, created) = time(unix_time);
let score = comment["data"]["score"].as_i64().unwrap_or(0); let score = comment["data"]["score"].as_i64().unwrap_or(0);

View File

@ -343,7 +343,7 @@ pub async fn fetch_posts(path: &str, fallback_title: String) -> Result<(Vec<Post
}, },
permalink: val(post, "permalink"), permalink: val(post, "permalink"),
rel_time, rel_time,
created created,
}); });
} }