]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/comment/create.rs
Remove redundant calls to `Iterator::collect` (#3365)
[lemmy.git] / crates / api_crud / src / comment / create.rs
index b3b1efecd60d2cb025ca1c6204dc01234d05ed0e..1bcc78483c3b8659ab81c3df51164051446551ef 100644 (file)
@@ -191,7 +191,7 @@ impl PerformCrud for CreateComment {
 
 pub fn check_comment_depth(comment: &Comment) -> Result<(), LemmyError> {
   let path = &comment.path.0;
-  let length = path.split('.').collect::<Vec<&str>>().len();
+  let length = path.split('.').count();
   if length > MAX_COMMENT_DEPTH_LIMIT {
     Err(LemmyError::from_message("max_comment_depth_reached"))
   } else {