<commit_before>
use std::vec::Vec;

enum TagTree<Leaf, Node, Edge> {
    Leaf(Leaf),
    Node(Node, Vec<(Edge, Box<TagTree<Leaf, Node, Edge>>)>)
}

impl<Leaf, Node, Edge> TagTree<Leaf, Node, Edge> {

    fn fold_tag_tree<T, FL, FN, FE> (
        &self,
        ref reduce_leaf: FL,
        ref reduce_node: FN,
        ref reduce_edge: FE) -> T
        where 
            FL: Fn(&Leaf) -> T, 
            FN: Fn(&Node, Vec<T>) -> T, 
            FE: Fn(&Edge, T) -> T 
            {
                match self {
                    &TagTree::Leaf(ref leaf) => reduce_leaf(leaf),
                    &TagTree::Node(ref node, ref children) => {
                        let subs = children.iter().map(|edgeChild| { 
                            match edgeChild {
                                &(ref edge, box ref child) => {
                                    let childT = child.fold_tag_tree(reduce_leaf, reduce_node, reduce_edge);    
                                    reduce_edge(edge, childT)
                                }
                            }
                        }).collect();
                        reduce_node(node, subs)
                    }
                }
            }<commit_msg>warnings<commit_after>
use std::vec::Vec;

pub enum TagTree<Leaf, Node, Edge> {
    Leaf(Leaf),
    Node(Node, Vec<(Edge, Box<TagTree<Leaf, Node, Edge>>)>)
}

impl<Leaf, Node, Edge> TagTree<Leaf, Node, Edge> {

    pub fn fold_tag_tree<T, FL, FN, FE> (
        &self,
        ref reduce_leaf: FL,
        ref reduce_node: FN,
        ref reduce_edge: FE) -> T
        where 
            FL: Fn(&Leaf) -> T, 
            FN: Fn(&Node, Vec<T>) -> T, 
            FE: Fn(&Edge, T) -> T 
            {
                match self {
                    &TagTree::Leaf(ref leaf) => reduce_leaf(leaf),
                    &TagTree::Node(ref node, ref children) => {
                        let subs = children.iter().map(|edge_child| { 
                            match edge_child {
                                &(ref edge, box ref child) => {
                                    let sub = child.fold_tag_tree(reduce_leaf, reduce_node, reduce_edge);    
                                    reduce_edge(edge, sub)
                                }
                            }
                        }).collect();
                        reduce_node(node, subs)
                    }
                }
            }
{'fraction_non_alphanumeric': 0.11711340206185566, 'fraction_numerical': 0.0, 'mean_word_length': 1.0611724723874256, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '177306', 'n_tokens_mistral': 714, 'n_tokens_neox': 672, 'n_words': 154}