diff --git a/futures/src/subscription.rs b/futures/src/subscription.rs index d14724f5..18e6cdd9 100644 --- a/futures/src/subscription.rs +++ b/futures/src/subscription.rs @@ -306,7 +306,9 @@ impl Subscription { F: Fn(T) -> A + MaybeSend + Clone + 'static, A: 'static, { - F::assert_zero_size(); + const { + check_zero_sized::(); + } struct Map where @@ -363,7 +365,9 @@ impl Subscription { F: Fn(T) -> Option + MaybeSend + Clone + 'static, A: MaybeSend + 'static, { - F::assert_zero_size(); + const { + check_zero_sized::(); + } struct FilterMap where @@ -522,17 +526,6 @@ where } } -trait PanicWhenNotZeroSized: Sized { - const _CHECK: () = check_zero_sized::(); - - #[allow(path_statements, clippy::no_effect)] - fn assert_zero_size() { - ::_CHECK; - } -} - -impl PanicWhenNotZeroSized for T {} - const fn check_zero_sized() { if std::mem::size_of::() != 0 { panic!(