Skip to content

Commit

Permalink
Manual Antichain::default to avoid bounds (#537)
Browse files Browse the repository at this point in the history
The derived `default` for Antichain includes a bound `T: Default`, which is
unnecessary. This change replaces the derived implementation with a custom
one that does not have the constrain.

Signed-off-by: Moritz Hoffmann <[email protected]>
  • Loading branch information
antiguru committed Nov 26, 2023
1 parent 98af39f commit 64be92b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion timely/src/progress/frontier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::order::{PartialOrder, TotalOrder};
/// Two antichains are equal if the contain the same set of elements, even if in different orders.
/// This can make equality testing quadratic, though linear in the common case that the sequences
/// are identical.
#[derive(Debug, Default, Abomonation, Serialize, Deserialize)]
#[derive(Debug, Abomonation, Serialize, Deserialize)]
pub struct Antichain<T> {
elements: Vec<T>
}
Expand Down Expand Up @@ -264,6 +264,12 @@ impl<T: Clone> Clone for Antichain<T> {
}
}

impl<T> Default for Antichain<T> {
fn default() -> Self {
Self::new()
}
}

impl<T: TotalOrder> TotalOrder for Antichain<T> { }

impl<T: TotalOrder> Antichain<T> {
Expand Down

0 comments on commit 64be92b

Please sign in to comment.