Apply a blacklist of extensions to a list of files

Hello,
I'm stuck for hours on a pretty simple problem is rust.

I have a vector of strings with filename and I would like to use .filter() to get only the files that don't ends_with() any of the blacklist array...

I have no idea why my code doesn't work :

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=5cc827d5a859a91a4d432a7e4564e2b1

do you know how should I do this please ?

Thanks

You're printing an iterator, not its result:

Filter { iter: Iter(["truc.png", "machin.php", "test.txt"]) }

To have the filtration really occur, you need to exhaust an iterator in some way. There are two main methods: one is to add the collect::<Vec<_>>() at the end (since you're not assigning the vector to variable, you need the turbofish, otherwise it might be simply collect()), or printing each filtered value by itself by using a for loop.

Yes I know but right now I want to have only "machin.php" in the iterator because "png" and "txt" are in the blacklist
edit: Oh I thought the iterator I printed have the same content of the vector via collect...
Thanks it works like you're telling me ! Sorry and thank you !