]> git.lizzy.rs Git - rust.git/commitdiff
Simplify UseTree::has_comment
authorSeiichi Uchida <seuchida@gmail.com>
Fri, 6 Apr 2018 14:03:11 +0000 (23:03 +0900)
committerSeiichi Uchida <seiichi.uchida@dena.com>
Tue, 10 Apr 2018 03:36:57 +0000 (12:36 +0900)
src/imports.rs

index 76fa7816f0d8511587274c086815c45eaaf50c80..03df4aed6af76e7e557d8a6b470de38b87f937bd 100644 (file)
@@ -446,9 +446,7 @@ pub fn normalize(mut self, do_sort: bool) -> UseTree {
     }
 
     fn has_comment(&self) -> bool {
-        self.list_item.as_ref().map_or(false, |list_item| {
-            list_item.pre_comment.is_some() || list_item.post_comment.is_some()
-        })
+        self.list_item.as_ref().map_or(false, ListItem::has_comment)
     }
 
     fn same_visibility(&self, other: &UseTree) -> bool {
@@ -526,7 +524,6 @@ fn merge(&mut self, other: UseTree) {
             if *a == b {
                 len = i + 1;
                 new_path.push(b);
-                continue;
             } else {
                 len = i;
                 break;