Fixes #19 ! (At least passes the test case...)

~~Looks like using sort() and dedup() on a Vec didn't correctly remove all duplicates, which meant that when we were destroying chains, we could end up destroying a chain with the same id twice. However, since the id would now refer to another chain, that chain would be deleted instead.~~

Fix (which is better than the original code anyway): Instead of using Vec<> when we want non-repeated elements, we now use HashSet<>, which should have been using from the start. Probably better performance than sort() + dedup() as well.

This way was used originally because Rust docs says "If the vector is sorted, this removes all duplicates.". Seems it wasn't/isn't so, or at least was changed in later revisions ?

I also changed Vec->sort->dedup somewhere else in the file to HashSet, as it's better anyways.

EDIT: Hypothesis wrong, magic is happening, see comments.