From: Seiichi Uchida Date: Fri, 6 Apr 2018 14:03:11 +0000 (+0900) Subject: Simplify UseTree::has_comment X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=4a7e45ec28fcbee14cd143402c1129d30cef39f0;p=rust.git Simplify UseTree::has_comment --- diff --git a/src/imports.rs b/src/imports.rs index 76fa7816f0d..03df4aed6af 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -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;