Skip to content

Commit 3b24ec3

Browse files
committed
Use map_while
1 parent ead0fc9 commit 3b24ec3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/visitor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,7 @@ impl<'b, 'a: 'b> FmtVisitor<'a> {
872872
// Extract leading `use ...;`.
873873
let items: Vec<_> = stmts
874874
.iter()
875-
.take_while(|stmt| stmt.to_item().map_or(false, is_use_item))
876-
.filter_map(|stmt| stmt.to_item())
875+
.map_while(|stmt| stmt.to_item().filter(|i| is_use_item(i)))
877876
.collect();
878877

879878
if items.is_empty() {

0 commit comments

Comments
 (0)