fn expand_impl(ast: &Item) -> Tokens {
    // Used in the quasi-quotation below as `#name`
    let name = &ast.ident;

    match ast.node {
        Trait(_, ref generics, _, _) => {
            let (impl_generics, _, where_clause) = generics.split_for_impl();

            if generics.ty_params.is_empty() {
                panic!("Cannot auto-implement {} since it does not have any type parameters!",
                       name)
            }

            quote! {
                impl #impl_generics #name #impl_generics for T #where_clause {}
            }
        }
        _ => {
            panic!("Cannot expand type {} implementation since it's not a trait!",
                   name)
        }
    }
}
/// Generates a default impl of the trait that gets passed into `autoimpl!`, with the same type
/// arguments and generic bounds as its trait.
Generates a default impl of the trait that gets passed into `autoimpl!`, with the same type
arguments and generic bounds as its trait.
Generates a default impl of the trait that gets passed into ` autoimpl! ` with the same type arguments and generic bounds as its trait .
fn expand_impl(ast: &Item) -> Tokens {
    // Used in the quasi-quotation below as `#name`
    let name = &ast.ident;
    match ast.node {
        Trait(_, ref generics, _, _) => {
            let (impl_generics, _, where_clause) = generics.split_for_impl();
            if generics.ty_params.is_empty() {
                panic!("Cannot auto-implement {} since it does not have any type parameters!",
                       name)
            }
            quote! {
                impl #impl_generics #name #impl_generics for T #where_clause {}
            }
        }
        _ => {
            panic!("Cannot expand type {} implementation since it's not a trait!",
                   name)
        }
    }
}
fn expand_impl ( ast : & Item ) -> Tokens { // Used in the quasi-quotation below as `#name` let name = & ast . ident ; match ast . node { Trait ( _ , ref generics , _ , _ ) => { let ( impl_generics , _ , where_clause ) = generics . split_for_impl ( ) ; if generics . ty_params . is_empty ( ) { panic ! ( " " name ) } quote ! { impl impl_generics name impl_generics for T where_clause { } } } _ => { panic ! ( " " name ) } } }
Generates a default impl of the trait that gets passed into `autoimpl!`, with the same type
arguments and generic bounds as its trait.
Generates a default impl of the trait that gets passed into ` autoimpl! ` with the same type arguments and generic bounds as its trait .
ast
&Item
ast
&Item