Skip to content

Commit

Permalink
fix: build.rs clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasdewally committed Jan 10, 2025
1 parent a38ba68 commit fe3e1ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions conjure_oxide/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() -> io::Result<()> {
let stems: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry.path().extension().map_or(false, |ext| {
entry.path().extension().is_some_and(|ext| {
ext == "essence" || ext == "eprime" || ext == "disabled"
})
})
Expand All @@ -38,7 +38,7 @@ fn main() -> io::Result<()> {
let exts: Vec<String> = read_dir(subdir.path())?
.filter_map(Result::ok)
.filter(|entry| {
entry.path().extension().map_or(false, |ext| {
entry.path().extension().is_some_and(|ext| {
ext == "essence" || ext == "eprime" || ext == "disabled"
})
})
Expand All @@ -61,7 +61,7 @@ fn main() -> io::Result<()> {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
.is_some_and(|ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
Expand All @@ -78,7 +78,7 @@ fn main() -> io::Result<()> {
entry
.path()
.extension()
.map_or(false, |ext| ext == "essence" || ext == "eprime")
.is_some_and(|ext| ext == "essence" || ext == "eprime")
})
.filter_map(|entry| {
entry
Expand Down
2 changes: 1 addition & 1 deletion crates/conjure_core/src/parse/example_models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn get_example_model(filename: &str) -> Result<Model, anyhow::Error> {
if path.is_file()
&& path
.extension()
.map_or(false, |e| e == "essence" || e == "eprime")
.is_some_and(|e| e == "essence" || e == "eprime")
&& path.file_stem() == Some(std::ffi::OsStr::new(filename))
{
essence_path = path.to_path_buf();
Expand Down
2 changes: 1 addition & 1 deletion crates/conjure_core/src/solver/adaptors/minion/adaptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ fn minion_rs_callback(solutions: HashMap<minion_ast::VarName, minion_ast::Consta
.unwrap();

let mut conjure_solutions: HashMap<conjure_ast::Name, conjure_ast::Literal> = HashMap::new();
let machine_name_re = Regex::new(r"__conjure_machine_name_([0-9]+)").unwrap();
for (minion_name, minion_const) in solutions.into_iter() {
let conjure_const = match minion_const {
minion_ast::Constant::Bool(x) => conjure_ast::Literal::Bool(x),
minion_ast::Constant::Integer(x) => conjure_ast::Literal::Int(x),
_ => todo!(),
};

let machine_name_re = Regex::new(r"__conjure_machine_name_([0-9]+)").unwrap();
let conjure_name = if let Some(caps) = machine_name_re.captures(&minion_name) {
conjure_ast::Name::MachineName(caps[1].parse::<i32>().unwrap())
} else {
Expand Down

0 comments on commit fe3e1ee

Please sign in to comment.