about summary refs log tree commit diff
path: root/web/converse/src/render.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-02-07T15·49+0300
committertazjin <tazjin@tvl.su>2022-02-08T12·06+0000
commit3d8ee620875085ae7e8d7ef31f4f8e3738cfdca1 (patch)
treec4597319495abbb82c9753791fbde11bfdb644f0 /web/converse/src/render.rs
parent3318982f81c01b570b7021fd9f71aa2bfe192271 (diff)
style(rust): Format all Rust code with rustfmt r/3791
Change-Id: Iab7e00cc26a4f9727d3ab98691ef379921a33052
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5240
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: Profpatsch <mail@profpatsch.de>
Reviewed-by: grfn <grfn@gws.fyi>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'web/converse/src/render.rs')
-rw-r--r--web/converse/src/render.rs43
1 files changed, 24 insertions, 19 deletions
diff --git a/web/converse/src/render.rs b/web/converse/src/render.rs
index 749e77ef50eb..d06af12bd9f1 100644
--- a/web/converse/src/render.rs
+++ b/web/converse/src/render.rs
@@ -20,14 +20,14 @@
 //! data into whatever format is needed by the templates and rendering
 //! them.
 
-use actix::prelude::*;
-use askama::Template;
 use crate::errors::*;
-use std::fmt;
-use md5;
 use crate::models::*;
+use actix::prelude::*;
+use askama::Template;
 use chrono::prelude::{DateTime, Utc};
-use comrak::{ComrakOptions, markdown_to_html};
+use comrak::{markdown_to_html, ComrakOptions};
+use md5;
+use std::fmt;
 
 pub struct Renderer {
     pub comrak: ComrakOptions,
@@ -101,7 +101,9 @@ pub enum EditingMode {
 }
 
 impl Default for EditingMode {
-    fn default() -> EditingMode { EditingMode::NewThread }
+    fn default() -> EditingMode {
+        EditingMode::NewThread
+    }
 }
 
 /// This is the template used for rendering the new thread, edit post
@@ -215,19 +217,22 @@ pub fn index_page(threads: Vec<ThreadIndex>) -> Result<String> {
 
 // Render the page of a given thread.
 pub fn thread_page(user: i32, thread: Thread, posts: Vec<SimplePost>) -> Result<String> {
-    let posts = posts.into_iter().map(|post| {
-        let editable = user != 1 && post.user_id == user;
-
-        let comrak = ComrakOptions::default(); // TODO(tazjin): cheddar
-        RenderablePost {
-            id: post.id,
-            body: markdown_to_html(&post.body, &comrak),
-            posted: FormattedDate(post.posted),
-            author_name: post.author_name.clone(),
-            author_gravatar: md5_hex(post.author_email.as_bytes()),
-            editable,
-        }
-    }).collect();
+    let posts = posts
+        .into_iter()
+        .map(|post| {
+            let editable = user != 1 && post.user_id == user;
+
+            let comrak = ComrakOptions::default(); // TODO(tazjin): cheddar
+            RenderablePost {
+                id: post.id,
+                body: markdown_to_html(&post.body, &comrak),
+                posted: FormattedDate(post.posted),
+                author_name: post.author_name.clone(),
+                author_gravatar: md5_hex(post.author_email.as_bytes()),
+                editable,
+            }
+        })
+        .collect();
 
     let renderable = RenderableThreadPage {
         posts,