Skip to content

Commit

Permalink
fmt & clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed May 30, 2024
1 parent be590b5 commit 0e51858
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion smt-log-parser/src/cmd/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ pub enum Commands {
Test {
/// The paths to the smt log files
logfiles: Vec<std::path::PathBuf>,
}
},
}
12 changes: 6 additions & 6 deletions smt-log-parser/src/cmd/dependencies.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::path::PathBuf;
use fxhash::{FxHashMap, FxHashSet};
use std::path::PathBuf;

use smt_log_parser::{
analysis::{
Expand Down Expand Up @@ -94,9 +94,9 @@ fn get_node_name<'a>(
fn build_axiom_dependency_graph(
parser: &Z3Parser,
) -> Result<FxHashMap<String, FxHashSet<String>>, smt_log_parser::Error> {
let inst_graph = RawInstGraph::new(&parser)?;
let inst_graph = RawInstGraph::new(parser)?;
let node_name_map: FxHashMap<RawNodeIndex, String> =
named_nodes(&inst_graph, &parser, inst_graph.node_indices())
named_nodes(&inst_graph, parser, inst_graph.node_indices())
.map(|(n, v)| (n, v.into()))
.collect();
let mut node_dep_map: FxHashMap<String, FxHashSet<String>> = FxHashMap::default();
Expand All @@ -112,7 +112,7 @@ fn build_axiom_dependency_graph(
continue;
}
for node in inst_graph.neighbors_directed(node, petgraph::Direction::Incoming) {
let is_named = get_node_name(&inst_graph, &parser, node).is_some();
let is_named = get_node_name(&inst_graph, parser, node).is_some();
// if this is a quantified axiom with a name, add it to the list of dependencies
if is_named {
dependent_nodes.insert(node);
Expand All @@ -133,15 +133,15 @@ fn build_axiom_dependency_graph(
entry.or_default().extend(dependent_node_names);
}

return Ok(node_dep_map);
Ok(node_dep_map)
}

/// extends the dependency graph by 1 transitive step
fn extend_by_transitive_deps(axiom_deps: &mut FxHashMap<String, FxHashSet<String>>) {
for (axiom, deps) in axiom_deps.clone().into_iter() {
for dep in deps {
let extended_deps: FxHashSet<String> =
axiom_deps.get(&dep).map(|v| v.clone()).unwrap_or_default();
axiom_deps.get(&dep).cloned().unwrap_or_default();
axiom_deps.get_mut(&axiom).unwrap().extend(extended_deps);
}
}
Expand Down
14 changes: 8 additions & 6 deletions smt-log-parser/src/cmd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
mod args;
mod test;
mod dependencies;
mod test;

use clap::Parser;

pub fn run() -> Result<(), String> {
match args::Cli::parse().command {
args::Commands::Dependencies { logfile, depth, pretty_print } =>
dependencies::run(logfile, depth, pretty_print)?,
args::Commands::Test { logfiles } =>
test::run(logfiles)?,
args::Commands::Dependencies {
logfile,
depth,
pretty_print,
} => dependencies::run(logfile, depth, pretty_print)?,
args::Commands::Test { logfiles } => test::run(logfiles)?,
}

Ok(())
}

0 comments on commit 0e51858

Please sign in to comment.