From c3661fb9d584f51ad44ccf65f08f3546cf2a5062 Mon Sep 17 00:00:00 2001 From: Douglas Wilson Date: Wed, 12 Jun 2024 13:16:15 +0100 Subject: [PATCH] lints --- src/custom/int.rs | 10 +++------- tests/guppy.rs | 15 ++++++++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/custom/int.rs b/src/custom/int.rs index 823aea8..a7ce7e7 100644 --- a/src/custom/int.rs +++ b/src/custom/int.rs @@ -7,7 +7,7 @@ use hugr::{ int_ops::{self, ConcreteIntOp}, int_types::{self, ConstInt}, }, - types::{CustomType, SumType, TypeArg}, + types::{CustomType, TypeArg}, HugrView, }; use inkwell::{ @@ -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, }; @@ -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}")), diff --git a/tests/guppy.rs b/tests/guppy.rs index 9358bfd..ae13703 100644 --- a/tests/guppy.rs +++ b/tests/guppy.rs @@ -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; @@ -10,7 +13,7 @@ struct TestConfig { python_bin: PathBuf, hugr_llvm_bin: PathBuf, test_dir: PathBuf, - pub opt: bool + pub opt: bool, } impl TestConfig { @@ -28,7 +31,7 @@ impl TestConfig { python_bin, hugr_llvm_bin, test_dir, - opt: true + opt: true, } } } @@ -71,7 +74,9 @@ fn test_dir_exists(test_config: TestConfig) { fn with_suffix(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) @@ -91,7 +96,7 @@ macro_rules! guppy_test { assert_cmd_snapshot!(test_config.hugr_llvm(&json_file)) }); } - } + }; } guppy_test!("even_odd.py", even_odd);