From 85ae7c1f605f1f77f6c05c404a24acf4697d8953 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Tue, 23 Nov 2021 22:23:29 -0800 Subject: [PATCH] Fix indentation and formatting --- src/main.rs | 3 +-- src/utils.rs | 33 +++++++++------------------------ templates/base.html | 2 +- templates/comment.html | 2 +- templates/subreddit.html | 20 ++++++++++---------- templates/utils.html | 4 ++-- templates/wall.html | 6 +++--- 7 files changed, 27 insertions(+), 43 deletions(-) diff --git a/src/main.rs b/src/main.rs index aa44e63..f311d3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,8 +133,7 @@ async fn main() { .get_matches(); let address = matches.value_of("address").unwrap_or("0.0.0.0"); - let port = std::env::var("PORT") - .unwrap_or_else(|_| matches.value_of("port").unwrap_or("8080").to_string()); + let port = std::env::var("PORT").unwrap_or_else(|_| matches.value_of("port").unwrap_or("8080").to_string()); let hsts = matches.value_of("hsts"); let listener = [address, ":", &port].concat(); diff --git a/src/utils.rs b/src/utils.rs index 0bcad3c..1e8e338 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -632,27 +632,12 @@ pub async fn error(req: Request, msg: String) -> Result, St mod tests { use super::format_num; - #[test] - fn format_num_works() { - assert_eq!( - format_num(567), - ("567".to_string(), "567".to_string()) - ); - assert_eq!( - format_num(1234), - ("1.2k".to_string(), "1234".to_string()) - ); - assert_eq!( - format_num(1999), - ("2.0k".to_string(), "1999".to_string()) - ); - assert_eq!( - format_num(1001), - ("1.0k".to_string(), "1001".to_string()) - ); - assert_eq!( - format_num(1_999_999), - ("2.0m".to_string(), "1999999".to_string()) - ); - } -} \ No newline at end of file + #[test] + fn format_num_works() { + assert_eq!(format_num(567), ("567".to_string(), "567".to_string())); + assert_eq!(format_num(1234), ("1.2k".to_string(), "1234".to_string())); + assert_eq!(format_num(1999), ("2.0k".to_string(), "1999".to_string())); + assert_eq!(format_num(1001), ("1.0k".to_string(), "1001".to_string())); + assert_eq!(format_num(1_999_999), ("2.0m".to_string(), "1999999".to_string())); + } +} diff --git a/templates/base.html b/templates/base.html index 9d469be..4e34683 100644 --- a/templates/base.html +++ b/templates/base.html @@ -12,7 +12,7 @@ - + diff --git a/templates/comment.html b/templates/comment.html index e258520..f019e0b 100644 --- a/templates/comment.html +++ b/templates/comment.html @@ -2,7 +2,7 @@ {% if kind == "more" && parent_kind == "t1" %} → More replies -{% else if kind == "t1" %} +{% else if kind == "t1" %}

{{ score.0 }}

diff --git a/templates/subreddit.html b/templates/subreddit.html index b5d02fa..9038440 100644 --- a/templates/subreddit.html +++ b/templates/subreddit.html @@ -104,16 +104,16 @@
{% endif %} diff --git a/templates/utils.html b/templates/utils.html index e19ace1..3745dea 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -87,7 +87,7 @@

{% if (prefs.layout.is_empty() || prefs.layout == "card") && post.post_type == "image" %} - + {% else %} - + Thumbnail diff --git a/templates/wall.html b/templates/wall.html index 309dac2..98499f6 100644 --- a/templates/wall.html +++ b/templates/wall.html @@ -4,10 +4,10 @@ {% block content %}

{{ title }}

-
+

{{ msg }}

-
+ -
+
{% endblock %}