Skip to content

Commit 6287924

Browse files
committed
tsort: use Option::inspect over map
1 parent 700a5f0 commit 6287924

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/uu/tsort/src/tsort.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ fn remove<T>(vec: &mut Vec<T>, x: T) -> Option<usize>
105105
where
106106
T: PartialEq,
107107
{
108-
vec.iter().position(|item| *item == x).map(|i| {
109-
vec.remove(i);
110-
i
108+
vec.iter().position(|item| *item == x).inspect(|i| {
109+
vec.remove(*i);
111110
})
112111
}
113112

0 commit comments

Comments
 (0)