From ea8e9aecb0b7795d10ccdcb49b5247e6c354fa4a Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 30 Oct 2023 14:02:34 +0000 Subject: [PATCH 1/2] chore: clippy fixes --- compiler/noirc_frontend/src/hir/type_check/expr.rs | 4 ++-- tooling/debugger/src/context.rs | 2 +- tooling/nargo/src/errors.rs | 2 +- tooling/nargo_fmt/src/utils.rs | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/type_check/expr.rs b/compiler/noirc_frontend/src/hir/type_check/expr.rs index 00534cc3aa2..09dba2cce86 100644 --- a/compiler/noirc_frontend/src/hir/type_check/expr.rs +++ b/compiler/noirc_frontend/src/hir/type_check/expr.rs @@ -293,9 +293,9 @@ impl<'interner> TypeChecker<'interner> { argument_types: &mut [(Type, ExprId, noirc_errors::Span)], ) { let expected_object_type = match function_type { - Type::Function(args, _, _) => args.get(0), + Type::Function(args, _, _) => args.first(), Type::Forall(_, typ) => match typ.as_ref() { - Type::Function(args, _, _) => args.get(0), + Type::Function(args, _, _) => args.first(), typ => unreachable!("Unexpected type for function: {typ}"), }, typ => unreachable!("Unexpected type for function: {typ}"), diff --git a/tooling/debugger/src/context.rs b/tooling/debugger/src/context.rs index 025e6404bcb..f8f573930c0 100644 --- a/tooling/debugger/src/context.rs +++ b/tooling/debugger/src/context.rs @@ -111,7 +111,7 @@ impl<'a, B: BlackBoxFunctionSolver> DebugContext<'a, B> { } pub(super) fn step_into_opcode(&mut self) -> DebugCommandResult { - if matches!(self.brillig_solver, Some(_)) { + if self.brillig_solver.is_some() { self.step_brillig_opcode() } else { match self.acvm.step_into_brillig_opcode() { diff --git a/tooling/nargo/src/errors.rs b/tooling/nargo/src/errors.rs index 0c920716f2a..ba52d127e9e 100644 --- a/tooling/nargo/src/errors.rs +++ b/tooling/nargo/src/errors.rs @@ -91,7 +91,7 @@ fn extract_locations_from_error( _ => None, }?; - if let Some(OpcodeLocation::Brillig { acir_index, .. }) = opcode_locations.get(0) { + if let Some(OpcodeLocation::Brillig { acir_index, .. }) = opcode_locations.first() { opcode_locations.insert(0, OpcodeLocation::Acir(*acir_index)); } diff --git a/tooling/nargo_fmt/src/utils.rs b/tooling/nargo_fmt/src/utils.rs index 44ffda976f9..7bb40956b2e 100644 --- a/tooling/nargo_fmt/src/utils.rs +++ b/tooling/nargo_fmt/src/utils.rs @@ -124,7 +124,6 @@ impl FindToken for str { Lexer::new(self) .skip_comments(false) .flatten() - .into_iter() .find_map(|spanned| f(spanned.token()).then(|| spanned.to_span().end())) } } From 6e612c6e4216c0b7caeb2252d2693cb4aad07b88 Mon Sep 17 00:00:00 2001 From: Tom French Date: Mon, 30 Oct 2023 15:01:56 +0000 Subject: [PATCH 2/2] chore: clippy --- acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs b/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs index c19554eb6bc..c816e5b4d1b 100644 --- a/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs +++ b/acvm-repo/barretenberg_blackbox_solver/src/wasm/pedersen.rs @@ -57,8 +57,7 @@ impl Pedersen for Barretenberg { #[test] fn pedersen_hash_to_point() -> Result<(), Error> { let barretenberg = Barretenberg::new(); - let (x, y) = barretenberg - .encrypt(vec![FieldElement::from(1 as u128), FieldElement::from(1 as u128)], 1)?; + let (x, y) = barretenberg.encrypt(vec![FieldElement::one(), FieldElement::one()], 1)?; let expected_x = FieldElement::from_hex( "0x12afb43195f5c621d1d2cabb5f629707095c5307fd4185a663d4e80bb083e878", )