From 35b37474d4b0e67d4caf744b657c34dbd6a2edc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sch=C3=BCtt?= Date: Wed, 18 Jan 2023 10:06:25 +0100 Subject: [PATCH] Revert unreadable clippy changes --- lib/compiler-llvm/src/abi/aarch64_systemv.rs | 14 ++++++++++---- lib/compiler-llvm/src/abi/x86_64_systemv.rs | 14 ++++++++++---- tests/lib/wast/src/spectest.rs | 1 + 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lib/compiler-llvm/src/abi/aarch64_systemv.rs b/lib/compiler-llvm/src/abi/aarch64_systemv.rs index 63069de8a22..cce3eb5ae39 100644 --- a/lib/compiler-llvm/src/abi/aarch64_systemv.rs +++ b/lib/compiler-llvm/src/abi/aarch64_systemv.rs @@ -19,16 +19,22 @@ pub struct Aarch64SystemV {} impl Abi for Aarch64SystemV { // Given a function definition, retrieve the parameter that is the vmctx pointer. + #[allow(clippy::bool_to_int_with_if)] fn get_vmctx_ptr_param<'ctx>(&self, func_value: &FunctionValue<'ctx>) -> PointerValue<'ctx> { func_value - .get_nth_param(u32::from( - func_value + .get_nth_param( + if func_value .get_enum_attribute( AttributeLoc::Param(0), Attribute::get_named_enum_kind_id("sret"), ) - .is_some(), - )) + .is_some() + { + 1 + } else { + 0 + }, + ) .unwrap() .into_pointer_value() } diff --git a/lib/compiler-llvm/src/abi/x86_64_systemv.rs b/lib/compiler-llvm/src/abi/x86_64_systemv.rs index 2e444d078a0..bf1114d214b 100644 --- a/lib/compiler-llvm/src/abi/x86_64_systemv.rs +++ b/lib/compiler-llvm/src/abi/x86_64_systemv.rs @@ -21,16 +21,22 @@ pub struct X86_64SystemV {} impl Abi for X86_64SystemV { // Given a function definition, retrieve the parameter that is the vmctx pointer. + #[allow(clippy::bool_to_int_with_if)] fn get_vmctx_ptr_param<'ctx>(&self, func_value: &FunctionValue<'ctx>) -> PointerValue<'ctx> { func_value - .get_nth_param(u32::from( - func_value + .get_nth_param( + if func_value .get_enum_attribute( AttributeLoc::Param(0), Attribute::get_named_enum_kind_id("sret"), ) - .is_some(), - )) + .is_some() + { + 1 + } else { + 0 + }, + ) .unwrap() .into_pointer_value() } diff --git a/tests/lib/wast/src/spectest.rs b/tests/lib/wast/src/spectest.rs index b4d44938491..7eda1b643b4 100644 --- a/tests/lib/wast/src/spectest.rs +++ b/tests/lib/wast/src/spectest.rs @@ -2,6 +2,7 @@ use wasmer::*; /// Return an instance implementing the "spectest" interface used in the /// spec testsuite. +#[allow(clippy::print_stdout)] pub fn spectest_importobject(store: &mut Store) -> Imports { let print = Function::new_typed(store, || {}); let print_i32 = Function::new_typed(store, |val: i32| println!("{}: i32", val));