Skip to content

Commit

Permalink
Run rustfmt on rewrite.rs and rewrite_tests.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieranoski702 committed Feb 8, 2024
1 parent 03a7ee5 commit b60d194
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
1 change: 0 additions & 1 deletion conjure_oxide/src/rewrite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ struct RuleResult<'a> {
new_expression: Expression,
}


/// # Returns
/// - A new expression after applying the rules to `expression` and its sub-expressions.
/// - The same expression if no rules are applicable.
Expand Down
26 changes: 20 additions & 6 deletions conjure_oxide/tests/rewrite_tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Tests for rewriting/simplifying parts of the AST

use core::panic;
use conjure_core::rule::Rule;
use conjure_rules::get_rules;
use core::panic;
use std::collections::HashMap;

use conjure_oxide::{ast::*, solvers::FromConjureModel, rewrite::rewrite};
use conjure_oxide::{ast::*, rewrite::rewrite, solvers::FromConjureModel};
use conjure_rules::get_rule_by_name;
use minion_rs::ast::{Constant, VarName};

Expand Down Expand Up @@ -574,9 +574,24 @@ fn rewrite_solve_xyz() {
};

// Insert variables and domains
model.variables.insert(variable_a.clone(), DecisionVariable { domain: domain.clone() });
model.variables.insert(variable_b.clone(), DecisionVariable { domain: domain.clone() });
model.variables.insert(variable_c.clone(), DecisionVariable { domain: domain.clone() });
model.variables.insert(
variable_a.clone(),
DecisionVariable {
domain: domain.clone(),
},
);
model.variables.insert(
variable_b.clone(),
DecisionVariable {
domain: domain.clone(),
},
);
model.variables.insert(
variable_c.clone(),
DecisionVariable {
domain: domain.clone(),
},
);

// Convert the model to MinionModel
let minion_model = conjure_oxide::solvers::minion::MinionModel::from_conjure(model).unwrap();
Expand All @@ -602,7 +617,6 @@ pub fn is_simple(expression: &Expression) -> bool {
new == *expression
}


/// # Returns
/// - Some(<new_expression>) after applying the first applicable rule to `expr` or a sub-expression.
/// - None if no rule is applicable to the expression or any sub-expression.
Expand Down

0 comments on commit b60d194

Please sign in to comment.