<commit_before>use std::collections::BTreeMap;
use std::io;
use std::io::BufRead;

fn main() {
    let mut counts: BTreeMap<String, isize> = BTreeMap::new();
    let stdin = io::stdin();
    for line_result in stdin.lock().lines() {
        if let Ok(line) = line_result {
            let lowercase_line = line.to_lowercase();
            let words = lowercase_line.split(|c: char| {
                 !(c.is_alphabetic() || c == '\'')
             });
             for word in words {
                 if word.len() > 0 {
                     *counts.entry(word.to_string()).or_insert(0) += 1;
                 }
             }
        } else {
            panic!("Error parsing stdin");
        }
    }
    for (key, value) in counts.iter() {
        println!("{} {}", key, value);
    }
}<commit_msg>Use match instead of if let<commit_after>use std::collections::BTreeMap;
use std::io;
use std::io::BufRead;

fn main() {
    let mut counts: BTreeMap<String, isize> = BTreeMap::new();
    let stdin = io::stdin();
    for line_result in stdin.lock().lines() {
        match line_result {
            Ok(line) => {
                let lowercase_line = line.to_lowercase();
                let words = lowercase_line.split(|c: char| {
                     !(c.is_alphabetic() || c == '\'')
                 }).filter(|s| !s.is_empty());
                 for word in words {
                    *(counts.entry(word.to_string()).or_insert(0)) += 1;
                 }
            },
            Err(e) => {
                panic!("Error parsing stdin: {:?}", e);
            }
        }
    }
    for (key, value) in counts.iter() {
        println!("{} {}", key, value);
    }
}
{'fraction_non_alphanumeric': 0.16288782816229117, 'fraction_numerical': 0.0029832935560859188, 'mean_word_length': 1.6576862123613312, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '6371479', 'n_tokens_mistral': 528, 'n_tokens_neox': 518, 'n_words': 114}