diff --git a/derive/src/trait_bounds.rs b/derive/src/trait_bounds.rs index 6b044efe..f803990d 100644 --- a/derive/src/trait_bounds.rs +++ b/derive/src/trait_bounds.rs @@ -128,9 +128,8 @@ pub fn add( let ty_params = generics .type_params() - .filter_map(|tp| { - skip_type_params.iter().all(|skip| skip != &tp.ident).then(|| tp.ident.clone()) - }) + .filter(|tp| skip_type_params.iter().all(|skip| skip != &tp.ident)) + .map(|tp| tp.ident.clone()) .collect::>(); if ty_params.is_empty() { return Ok(()) diff --git a/tests/max_encoded_len_ui.rs b/tests/max_encoded_len_ui.rs index 2bf41457..c4c4cf4e 100644 --- a/tests/max_encoded_len_ui.rs +++ b/tests/max_encoded_len_ui.rs @@ -16,9 +16,6 @@ #[test] #[cfg(feature = "derive")] fn derive_no_bound_ui() { - // As trybuild is using `cargo check`, we don't need the real WASM binaries. - std::env::set_var("SKIP_WASM_BUILD", "1"); - let t = trybuild::TestCases::new(); t.compile_fail("tests/max_encoded_len_ui/*.rs"); t.pass("tests/max_encoded_len_ui/pass/*.rs"); diff --git a/tests/max_encoded_len_ui/crate_str.stderr b/tests/max_encoded_len_ui/crate_str.stderr index c9c46cb1..23a451f6 100644 --- a/tests/max_encoded_len_ui/crate_str.stderr +++ b/tests/max_encoded_len_ui/crate_str.stderr @@ -5,24 +5,24 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa | ^^^^^ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/crate_str.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` + --> tests/max_encoded_len_ui/crate_str.rs:5:8 + | +5 | struct Example; + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/incomplete_attr.stderr b/tests/max_encoded_len_ui/incomplete_attr.stderr index b9c58104..b5ab07c7 100644 --- a/tests/max_encoded_len_ui/incomplete_attr.stderr +++ b/tests/max_encoded_len_ui/incomplete_attr.stderr @@ -5,24 +5,24 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa | ^^^^^ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/incomplete_attr.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` + --> tests/max_encoded_len_ui/incomplete_attr.rs:5:8 + | +5 | struct Example; + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/missing_crate_specifier.stderr b/tests/max_encoded_len_ui/missing_crate_specifier.stderr index c056aec9..68e98a6a 100644 --- a/tests/max_encoded_len_ui/missing_crate_specifier.stderr +++ b/tests/max_encoded_len_ui/missing_crate_specifier.stderr @@ -5,24 +5,24 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa | ^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/missing_crate_specifier.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` + --> tests/max_encoded_len_ui/missing_crate_specifier.rs:5:8 + | +5 | struct Example; + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/not_encode.stderr b/tests/max_encoded_len_ui/not_encode.stderr index 3e4e57bc..b2fb1d85 100644 --- a/tests/max_encoded_len_ui/not_encode.stderr +++ b/tests/max_encoded_len_ui/not_encode.stderr @@ -1,22 +1,22 @@ error[E0277]: the trait bound `NotEncode: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/not_encode.rs:4:8 - | -4 | struct NotEncode; - | ^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `NotEncode` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `NotEncode` to implement `Encode` + --> tests/max_encoded_len_ui/not_encode.rs:4:8 + | +4 | struct NotEncode; + | ^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `NotEncode` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `NotEncode` to implement `Encode` note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/union.stderr b/tests/max_encoded_len_ui/union.stderr index af3dc931..fa21ec9c 100644 --- a/tests/max_encoded_len_ui/union.stderr +++ b/tests/max_encoded_len_ui/union.stderr @@ -1,5 +1,5 @@ error: Union types are not supported. - --> $DIR/union.rs:4:1 + --> tests/max_encoded_len_ui/union.rs:4:1 | 4 | union Union { | ^^^^^ diff --git a/tests/max_encoded_len_ui/unsupported_variant.stderr b/tests/max_encoded_len_ui/unsupported_variant.stderr index c4a48c60..848139a1 100644 --- a/tests/max_encoded_len_ui/unsupported_variant.stderr +++ b/tests/max_encoded_len_ui/unsupported_variant.stderr @@ -5,12 +5,12 @@ error[E0277]: the trait bound `NotMel: MaxEncodedLen` is not satisfied | ^^^^^^ the trait `MaxEncodedLen` is not implemented for `NotMel` | = help: the following other types implement trait `MaxEncodedLen`: - () - (TupleElement0, TupleElement1) - (TupleElement0, TupleElement1, TupleElement2) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) + bool + i8 + i16 + i32 + i64 + i128 + u8 + u16 and $N others