Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: Remove sorting of items before shuffling
Matthias Beyer committed 8 months ago
commit eb18819b35a058730b88fb4d3e8b3e76920d3969
parent 86154cae1ab25aa13e4c79a7f760be06c3060949
1 file changed +0 -2
modified crates/radicle/src/node/address.rs
@@ -67,7 +67,6 @@ impl<K: hash::Hash + Eq + Ord + Copy, V> AddressBook<K, V> {
    /// Return a shuffled iterator.
    pub fn shuffled(&self) -> std::vec::IntoIter<(&K, &V)> {
        let mut items = self.inner.iter().collect::<Vec<_>>();
-
        items.sort_by_key(|(k, _)| *k);
        self.rng.borrow_mut().shuffle(&mut items);

        items.into_iter()
@@ -76,7 +75,6 @@ impl<K: hash::Hash + Eq + Ord + Copy, V> AddressBook<K, V> {
    /// Turn this object into a shuffled iterator.
    pub fn into_shuffled(self) -> impl Iterator<Item = (K, V)> {
        let mut items = self.inner.into_iter().collect::<Vec<_>>();
-
        items.sort_by_key(|(k, _)| *k);
        self.rng.borrow_mut().shuffle(&mut items);

        items.into_iter()