Skip to content

Commit

Permalink
tsort: use Option::inspect over map
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Jan 11, 2025
1 parent 700a5f0 commit 6287924
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/uu/tsort/src/tsort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ fn remove<T>(vec: &mut Vec<T>, x: T) -> Option<usize>
where
T: PartialEq,
{
vec.iter().position(|item| *item == x).map(|i| {
vec.remove(i);
i
vec.iter().position(|item| *item == x).inspect(|i| {
vec.remove(*i);
})
}

Expand Down

0 comments on commit 6287924

Please sign in to comment.