Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
ketkarameya committed Sep 2, 2022
1 parent e49ddda commit 3a26031
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions polyglot/piranha/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ use std::{fs, time::Instant};
use log::info;
use polyglot_piranha::{
execute_piranha, models::piranha_arguments::PiranhaArguments,
models::piranha_output::PiranhaOutputSummary, utilities::initialize_logger,
models::piranha_output::PiranhaOutputSummary,
};

fn main() {
let now = Instant::now();
initialize_logger(false);
env_logger::init();

let args = PiranhaArguments::from_command_line();

Expand Down
4 changes: 2 additions & 2 deletions polyglot/piranha/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::config::CommandLineArguments;
use crate::execute_piranha;
use crate::models::piranha_arguments::PiranhaArguments;
use crate::models::piranha_output::PiranhaOutputSummary;
use crate::utilities::{eq_without_whitespace, find_file, initialize_logger, read_file};
use crate::utilities::{eq_without_whitespace, find_file, read_file};

mod test_piranha_java;
mod test_piranha_kt;
Expand All @@ -34,7 +34,7 @@ static INIT: Once = Once::new();

fn initialize() {
INIT.call_once(|| {
initialize_logger(true);
env_logger::init();
});
}

Expand Down
13 changes: 1 addition & 12 deletions polyglot/piranha/src/utilities/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ Copyright (c) 2022 Uber Technologies, Inc.
*/

pub(crate) mod tree_sitter_utilities;

use std::collections::HashMap;
#[cfg(test)]
use std::fs::{self, DirEntry};
use std::fs::{File, OpenOptions};
use std::fs::File;
use std::hash::Hash;
use std::io::{BufReader, Read};
use std::path::PathBuf;
use env_logger::{Env, Builder};

// Reads a file.
pub(crate) fn read_file(file_path: &PathBuf) -> Result<String, String> {
Expand Down Expand Up @@ -66,15 +64,6 @@ impl<T: Hash + Eq, U> MapOfVec<T, U> for HashMap<T, Vec<U>> {
}
}

/// Initialize logger.
pub fn initialize_logger(is_test: bool) {
Builder::default()
.format_timestamp(None)
.is_test(is_test)
.default_format()
.init();
}

/// Compares two strings, ignoring whitespace
pub(crate) fn eq_without_whitespace(s1: &str, s2: &str) -> bool {
s1.split_whitespace()
Expand Down

0 comments on commit 3a26031

Please sign in to comment.