summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--macros/src/expectation.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/macros/src/expectation.rs b/macros/src/expectation.rs
index 5a4922c..a6d181f 100644
--- a/macros/src/expectation.rs
+++ b/macros/src/expectation.rs
@@ -278,6 +278,12 @@ impl ToTokens for Expectation
let (boundless_impl_generics, _, _) = boundless_generics.split_for_impl();
+ let do_strip_generic_params = if generic_params.is_empty() {
+ quote! { self }
+ } else {
+ quote! { unsafe { std::mem::transmute(self) } }
+ };
+
quote! {
#expectation_struct
@@ -323,7 +329,7 @@ impl ToTokens for Expectation
self,
) -> #ident<#(#bogus_generics),*>
{
- unsafe { std::mem::transmute(self) }
+ #do_strip_generic_params
}
fn get_returning(&self) -> &#returning_fn