diff --git a/radicle/src/cob/patch.rs b/radicle/src/cob/patch.rs index ade04644..fe022f2c 100644 --- a/radicle/src/cob/patch.rs +++ b/radicle/src/cob/patch.rs @@ -678,8 +678,8 @@ impl store::FromHistory for Patch { // case of a rebase off the master branch, or a redaction of the // merge. let Ok(head) = repo.reference_oid(&op.author, &branch) else { - continue; - }; + continue; + }; if commit != head && !repo.is_ancestor_of(commit, head)? { continue; } diff --git a/radicle/src/node/address/types.rs b/radicle/src/node/address/types.rs index d4abe98b..133276c7 100644 --- a/radicle/src/node/address/types.rs +++ b/radicle/src/node/address/types.rs @@ -49,19 +49,6 @@ impl AddressBook { } } - /// Cycle through the keys at random. The random cycle repeats ad-infintum. - pub fn cycle(&self) -> impl Iterator { - self.shuffled().map(|(k, _)| k).cycle() - } - - /// Return a shuffled iterator over the keys. - pub fn shuffled(&self) -> std::vec::IntoIter<(&K, &V)> { - let mut items = self.inner.iter().collect::>(); - self.rng.shuffle(&mut items); - - items.into_iter() - } - /// Return a new address book with the given RNG. pub fn with(self, rng: fastrand::Rng) -> Self { Self { @@ -71,6 +58,22 @@ impl AddressBook { } } +impl AddressBook { + /// Return a shuffled iterator over the keys. + pub fn shuffled(&self) -> std::vec::IntoIter<(&K, &V)> { + let mut items = self.inner.iter().collect::>(); + items.sort_by_key(|(k, _)| *k); + self.rng.shuffle(&mut items); + + items.into_iter() + } + + /// Cycle through the keys at random. The random cycle repeats ad-infintum. + pub fn cycle(&self) -> impl Iterator { + self.shuffled().map(|(k, _)| k).cycle() + } +} + impl Deref for AddressBook { type Target = RandomMap;