1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

tsort: use Option::inspect over map

This commit is contained in:
Jeffrey Finkelstein 2025-01-11 11:58:51 -05:00
parent 700a5f007a
commit 62879244cb

View file

@ -105,9 +105,8 @@ fn remove<T>(vec: &mut Vec<T>, x: T) -> Option<usize>
where where
T: PartialEq, T: PartialEq,
{ {
vec.iter().position(|item| *item == x).map(|i| { vec.iter().position(|item| *item == x).inspect(|i| {
vec.remove(i); vec.remove(*i);
i
}) })
} }