<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

mod common {
    use std::env;
    use std::path::PathBuf;

    lazy_static! {
        pub static ref OUTDIR_PATH: PathBuf =
            PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("gecko");
    }
}

#[cfg(feature = "bindgen")]
mod bindings {
    use bindgen::{Builder, CodegenConfig};
    use regex::Regex;
    use std::cmp;
    use std::collections::{HashMap, HashSet};
    use std::env;
    use std::fs::{self, File};
    use std::io::{Read, Write};
    use std::path::{Path, PathBuf};
    use std::process::{exit, Command};
    use std::slice;
    use std::sync::Mutex;
    use std::time::SystemTime;
    use super::common::*;
    use super::super::PYTHON;
    use toml;
    use toml::value::Table;

    const STRUCTS_FILE: &'static str = "structs.rs";
    const BINDINGS_FILE: &'static str = "bindings.rs";

    fn read_config(path: &PathBuf) -> Table {
        println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
        update_last_modified(&path);

        let mut contents = String::new();
        File::open(path)
            .expect("Failed to open config file")
            .read_to_string(&mut contents)
            .expect("Failed to read config file");
        match toml::from_str::<toml::value::Table>(&contents) {
            Ok(result) => result,
            Err(e) => panic!("Failed to parse config file: {}", e),<commit_msg>style: Remove unused HashMap import and remove namespacing around Table.<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

mod common {
    use std::env;
    use std::path::PathBuf;

    lazy_static! {
        pub static ref OUTDIR_PATH: PathBuf =
            PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("gecko");
    }
}

#[cfg(feature = "bindgen")]
mod bindings {
    use bindgen::{Builder, CodegenConfig};
    use regex::Regex;
    use std::cmp;
    use std::collections::HashSet;
    use std::env;
    use std::fs::{self, File};
    use std::io::{Read, Write};
    use std::path::{Path, PathBuf};
    use std::process::{exit, Command};
    use std::slice;
    use std::sync::Mutex;
    use std::time::SystemTime;
    use super::common::*;
    use super::super::PYTHON;
    use toml;
    use toml::value::Table;

    const STRUCTS_FILE: &'static str = "structs.rs";
    const BINDINGS_FILE: &'static str = "bindings.rs";

    fn read_config(path: &PathBuf) -> Table {
        println!("cargo:rerun-if-changed={}", path.to_str().unwrap());
        update_last_modified(&path);

        let mut contents = String::new();
        File::open(path)
            .expect("Failed to open config file")
            .read_to_string(&mut contents)
            .expect("Failed to read config file");
        match toml::from_str::<Table>(&contents) {
            Ok(result) => result,
            Err(e) => panic!("Failed to parse config file: {}", e),
{'fraction_non_alphanumeric': 0.15756630265210608, 'fraction_numerical': 0.0024960998439937598, 'mean_word_length': 2.977667493796526, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6321040', 'n_tokens_mistral': 1016, 'n_tokens_neox': 1021, 'n_words': 277}