mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-27 12:17:35 +03:00
reduce code bloat
This commit is contained in:
parent
649088905d
commit
cedf2004ba
@ -57,9 +57,9 @@ fn new_compiler(path: PathBuf, theorem_options: Option<AstSnapshotOptions>) -> E
|
||||
)
|
||||
}
|
||||
|
||||
fn hash_file(path: &std::path::Path) -> String {
|
||||
fn hash_file(path: &str) -> String {
|
||||
use sha2::{Digest, Sha256};
|
||||
let mut file = std::fs::File::open(&path).unwrap();
|
||||
let mut file = std::fs::File::open(&Path::new(path)).unwrap();
|
||||
let mut hasher = Sha256::new();
|
||||
std::io::copy(&mut file, &mut hasher).unwrap();
|
||||
let hash = hasher.finalize();
|
||||
@ -211,9 +211,9 @@ impl Namespace for CompileNamespace {
|
||||
});
|
||||
}
|
||||
|
||||
let initial_ast: String = hash_file(Path::new("/tmp/output/initial_ast.json"));
|
||||
let canonicalized_ast: String = hash_file(Path::new("/tmp/output/canonicalization_ast.json"));
|
||||
let type_inferenced_ast = hash_file(Path::new("/tmp/output/type_inferenced_ast.json"));
|
||||
let initial_ast: String = hash_file("/tmp/output/initial_ast.json");
|
||||
let canonicalized_ast: String = hash_file("/tmp/output/canonicalization_ast.json");
|
||||
let type_inferenced_ast = hash_file("/tmp/output/type_inferenced_ast.json");
|
||||
|
||||
/* if std::fs::read_dir("/tmp/output").is_ok() {
|
||||
std::fs::remove_dir_all(std::path::Path::new("/tmp/output")).expect("Error failed to clean up output dir.");
|
||||
|
Loading…
Reference in New Issue
Block a user