Skip to content

Commit febdc30

Browse files
authored
Remove unneeded Ord bound from All, Contains supports tuples (paritytech#8691)
* Remove unneeded `Ord` bound from All * Fixes * Contains supports tuples
1 parent 37e97cf commit febdc30

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

frame/support/src/traits/members.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,20 @@ pub trait Contains<T> {
2727

2828
/// A `Contains` implementation which always returns `true`.
2929
pub struct All<T>(PhantomData<T>);
30-
impl<T: Ord> Contains<T> for All<T> {
30+
impl<T> Contains<T> for All<T> {
3131
fn contains(_: &T) -> bool { true }
3232
}
3333

34+
#[impl_trait_for_tuples::impl_for_tuples(30)]
35+
impl<T> Contains<T> for Tuple {
36+
fn contains(t: &T) -> bool {
37+
for_tuples!( #(
38+
if Tuple::contains(t) { return true }
39+
)* );
40+
false
41+
}
42+
}
43+
3444
/// Create a type which implements the `Contains` trait for a particular type with syntax similar
3545
/// to `matches!`.
3646
#[macro_export]

0 commit comments

Comments
 (0)