Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-q committed Jun 12, 2024
1 parent 76a9fd6 commit c3661fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/custom/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use hugr::{
int_ops::{self, ConcreteIntOp},
int_types::{self, ConstInt},
},
types::{CustomType, SumType, TypeArg},
types::{CustomType, TypeArg},
HugrView,
};
use inkwell::{
Expand All @@ -16,7 +16,7 @@ use inkwell::{
};

use crate::{
emit::{func::EmitFuncContext, emit_value, EmitOp, EmitOpArgs, NullEmitLlvm},
emit::{emit_value, func::EmitFuncContext, EmitOp, EmitOpArgs, NullEmitLlvm},
types::TypingSession,
};

Expand Down Expand Up @@ -53,11 +53,7 @@ impl<'c, H: HugrView> EmitOp<'c, CustomOp, H> for IntOpEmitter<'c, '_, H> {
"isub" => {
let builder = self.0.builder();
let [lhs, rhs] = TryInto::<[_; 2]>::try_into(args.inputs).unwrap();
let a = builder.build_int_sub(
lhs.into_int_value(),
rhs.into_int_value(),
"",
)?;
let a = builder.build_int_sub(lhs.into_int_value(), rhs.into_int_value(), "")?;
args.outputs.finish(builder, [a.into()])
}
n => Err(anyhow!("IntOpEmitter: unknown name: {n}")),
Expand Down
15 changes: 10 additions & 5 deletions tests/guppy.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::{
env, fmt::Display, fs::File, path::{Path, PathBuf}, process::Command
env,
fmt::Display,
path::{Path, PathBuf},
process::Command,
};

use insta_cmd::assert_cmd_snapshot;
Expand All @@ -10,7 +13,7 @@ struct TestConfig {
python_bin: PathBuf,
hugr_llvm_bin: PathBuf,
test_dir: PathBuf,
pub opt: bool
pub opt: bool,
}

impl TestConfig {
Expand All @@ -28,7 +31,7 @@ impl TestConfig {
python_bin,
hugr_llvm_bin,
test_dir,
opt: true
opt: true,
}
}
}
Expand Down Expand Up @@ -71,7 +74,9 @@ fn test_dir_exists(test_config: TestConfig) {

fn with_suffix<R>(s: impl Display, go: impl FnOnce() -> R) -> R {
let mut settings = insta::Settings::clone_current();
let old_suffix = settings.snapshot_suffix().map_or("".to_string(),|s| format!("{s}."));
let old_suffix = settings
.snapshot_suffix()
.map_or("".to_string(), |s| format!("{s}."));
let llvm_str = hugr_llvm::llvm_version();
settings.set_snapshot_suffix(format!("{old_suffix}{llvm_str}.{s}"));
settings.bind(go)
Expand All @@ -91,7 +96,7 @@ macro_rules! guppy_test {
assert_cmd_snapshot!(test_config.hugr_llvm(&json_file))
});
}
}
};
}

guppy_test!("even_odd.py", even_odd);

0 comments on commit c3661fb

Please sign in to comment.