]> Untitled Git - lemmy.git/commitdiff
Fix formatting.
authorDessalines <tyhou13@gmx.com>
Wed, 12 Aug 2020 14:45:04 +0000 (10:45 -0400)
committerDessalines <tyhou13@gmx.com>
Wed, 12 Aug 2020 14:45:04 +0000 (10:45 -0400)
server/lemmy_db/src/post.rs
server/lemmy_utils/src/lib.rs

index de8f5c6c861dd0c6656c1783ff4215bff00774fe..b6d7de8fe959e1760f17c2a88b7d3e6cd08f4d4d 100644 (file)
@@ -1,4 +1,11 @@
-use crate::{naive_now, schema::{post, post_like, post_read, post_saved}, Crud, Likeable, Saveable, Readable};
+use crate::{
+  naive_now,
+  schema::{post, post_like, post_read, post_saved},
+  Crud,
+  Likeable,
+  Readable,
+  Saveable,
+};
 use diesel::{dsl::*, result::Error, *};
 use serde::{Deserialize, Serialize};
 use url::{ParseError, Url};
@@ -430,17 +437,17 @@ mod tests {
 
     // Post Read
     let post_read_form = PostReadForm {
-    post_id: inserted_post.id,
-    user_id: inserted_user.id,
-  };
+      post_id: inserted_post.id,
+      user_id: inserted_user.id,
+    };
 
     let inserted_post_read = PostRead::mark_as_read(&conn, &post_read_form).unwrap();
 
     let expected_post_read = PostRead {
-    id: inserted_post_read.id,
-    post_id: inserted_post.id,
-    user_id: inserted_user.id,
-    published: inserted_post_read.published,
+      id: inserted_post_read.id,
+      post_id: inserted_post.id,
+      user_id: inserted_user.id,
+      published: inserted_post_read.published,
     };
 
     let read_post = Post::read(&conn, inserted_post.id).unwrap();
index ed96ad2cddc2f56132daa07eab32f276fb3b7a73..d4c75bf31593adb8034191cff9b9756f3ab85769 100644 (file)
@@ -160,7 +160,9 @@ pub fn is_valid_username(name: &str) -> bool {
 
 // Can't do a regex here, reverse lookarounds not supported
 pub fn is_valid_preferred_username(preferred_username: &str) -> bool {
-  !preferred_username.starts_with("@") && preferred_username.len() >=3 && preferred_username.len() <= 20
+  !preferred_username.starts_with("@")
+    && preferred_username.len() >= 3
+    && preferred_username.len() <= 20
 }
 
 pub fn is_valid_community_name(name: &str) -> bool {
@@ -176,8 +178,8 @@ mod tests {
   use crate::{
     is_valid_community_name,
     is_valid_post_title,
-    is_valid_username,
     is_valid_preferred_username,
+    is_valid_username,
     remove_slurs,
     scrape_text_for_mentions,
     slur_check,