<commit_before>use std::rc::Rc;
struct ListNode {
    val: i32,
    next: Option<Box<ListNode>>,
}

impl ListNode {
    fn new(v: i32) -> Self {
        ListNode { val: v, next: None }
    }
}

fn check_ten(this: &mut ListNode, f: &i32) {
    let mut inner_this = this;
    let mut temp: Rc<&mut Box<ListNode>>;
    let mut flag = *f;
    while let Some(t) = { inner_this } {
        t.val += flag;
        if t.val >= 10 {
            t.val = t.val - 10;
            flag = 1;
        } else {
            flag = 0
        }
        temp = Rc::new(t);
        let next = &mut t.next;
        inner_this = next;
    }
    if flag == 1 {
        temp.next = Some(Box::new(ListNode::new(1)));
    }
}

fn main() {
    //let a = ListNode::new(1);
    //let mut b = ListNode::new(9);
    //b.next = Some(Box::new(ListNode::new(2)));

    let mut c = Some(Box::new(ListNode::new(9)));
    check_ten(&mut c, &1);
}<commit_msg>change funtion to method<commit_after>#[derive(Debug)]
struct ListNode {
    val: i32,
    next: Option<Box<ListNode>>,
}

impl ListNode {
    fn new(v: i32) -> Self {
        ListNode { val: v, next: None }
    }

    fn check_ten(&mut self, flag: i32) {
        let mut inner_flag = flag;
        self.val += flag;
        if self.val >= 10 {
            self.val -= 10;
            inner_flag = 1;
        }
        match self.next {
            Some(ref mut n) => n.check_ten(inner_flag),
            None => if inner_flag == 1 {
                self.next = Some(Box::new(ListNode::new(inner_flag)));
            },
        }
    }
}

fn main() {
    //let a = ListNode::new(1);
    //let mut b = ListNode::new(9);
    //b.next = Some(Box::new(ListNode::new(2)));

    let mut c = Box::new(ListNode::new(9));
    c.check_ten(1);
    println!("{:?}", c);
    println!("{:?}", c.next);
}
{'fraction_non_alphanumeric': 0.17689331122166943, 'fraction_numerical': 0.01990049751243781, 'mean_word_length': 1.896, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5965092', 'n_tokens_mistral': 689, 'n_tokens_neox': 665, 'n_words': 157}