From 0d65a936d2345caeeb11442781c6ea90c7b4b9ed Mon Sep 17 00:00:00 2001 From: Gavin Wood <gavin@parity.io> Date: Wed, 28 Apr 2021 18:25:00 +0200 Subject: [PATCH] Remove unneeded `Ord` bound from All, Contains supports tuples (#8691) * Remove unneeded `Ord` bound from All * Fixes * Contains supports tuples --- substrate/frame/support/src/traits/members.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/substrate/frame/support/src/traits/members.rs b/substrate/frame/support/src/traits/members.rs index 125f096fa92..8b9c2c90f54 100644 --- a/substrate/frame/support/src/traits/members.rs +++ b/substrate/frame/support/src/traits/members.rs @@ -27,10 +27,20 @@ pub trait Contains<T> { /// A `Contains` implementation which always returns `true`. pub struct All<T>(PhantomData<T>); -impl<T: Ord> Contains<T> for All<T> { +impl<T> Contains<T> for All<T> { fn contains(_: &T) -> bool { true } } +#[impl_trait_for_tuples::impl_for_tuples(30)] +impl<T> Contains<T> for Tuple { + fn contains(t: &T) -> bool { + for_tuples!( #( + if Tuple::contains(t) { return true } + )* ); + false + } +} + /// Create a type which implements the `Contains` trait for a particular type with syntax similar /// to `matches!`. #[macro_export] -- GitLab