Test for default name of struct with type params

This commit is contained in:
Graham Esau 2019-08-07 13:32:44 +01:00
parent 54cfd2ba0e
commit d14db450cf
4 changed files with 100 additions and 2 deletions

View file

@ -33,8 +33,7 @@ pub fn derive_make_schema(input: proc_macro::TokenStream) -> proc_macro::TokenSt
let type_params: Vec<_> = cont.generics.type_params().map(|ty| &ty.ident).collect();
let type_param_fmt = match type_params.len() {
0 => "{}".to_owned(),
1 => "{}_For_{}".to_owned(),
n => format!("{{}}_For_{{}}_And{}", "_{}".repeat(n - 1)),
n => format!("{{}}_For_{{}}{}", "_And_{}".repeat(n - 1)),
};
let (impl_generics, ty_generics, where_clause) = cont.generics.split_for_impl();