From b1ccd71094ed8686e480f34da62a50886b896975 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 28 Aug 2023 11:41:13 +0100 Subject: [PATCH] chore: Run `cargo fmt` (#2455) --- crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs | 7 ++++++- .../src/hir/resolution/resolver.rs | 3 +-- .../noirc_frontend/src/hir/type_check/expr.rs | 6 +++++- .../src/monomorphization/mod.rs | 19 ++++++++++++++----- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs b/crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs index 59bdf7ff0e6..3ba5c574110 100644 --- a/crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs +++ b/crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs @@ -207,7 +207,12 @@ impl<'a> FunctionContext<'a> { let rhs = rhs.into_leaf().eval(self); let typ = self.builder.type_of_value(rhs); let zero = self.builder.numeric_constant(0u128, typ); - self.insert_binary(zero, noirc_frontend::BinaryOpKind::Subtract, rhs, unary.location) + self.insert_binary( + zero, + noirc_frontend::BinaryOpKind::Subtract, + rhs, + unary.location, + ) } noirc_frontend::UnaryOp::MutableReference => { self.codegen_reference(&unary.rhs).map(|rhs| { diff --git a/crates/noirc_frontend/src/hir/resolution/resolver.rs b/crates/noirc_frontend/src/hir/resolution/resolver.rs index 47d624e028e..bcb9cf4a9bf 100644 --- a/crates/noirc_frontend/src/hir/resolution/resolver.rs +++ b/crates/noirc_frontend/src/hir/resolution/resolver.rs @@ -700,8 +700,7 @@ impl<'a> Resolver<'a> { self.push_err(ResolverError::DistinctNotAllowed { ident: func.name_ident().clone() }); } - if matches!(attributes, Some(Attribute::Test { .. })) && !parameters.is_empty() - { + if matches!(attributes, Some(Attribute::Test { .. })) && !parameters.is_empty() { self.push_err(ResolverError::TestFunctionHasParameters { span: func.name_ident().span(), }); diff --git a/crates/noirc_frontend/src/hir/type_check/expr.rs b/crates/noirc_frontend/src/hir/type_check/expr.rs index 7a0c0eb2c7d..a150f198281 100644 --- a/crates/noirc_frontend/src/hir/type_check/expr.rs +++ b/crates/noirc_frontend/src/hir/type_check/expr.rs @@ -343,7 +343,11 @@ impl<'interner> TypeChecker<'interner> { rhs: method_call.object, })); self.interner.push_expr_type(&method_call.object, new_type); - self.interner.push_expr_location(method_call.object, location.span, location.file); + self.interner.push_expr_location( + method_call.object, + location.span, + location.file, + ); } } } diff --git a/crates/noirc_frontend/src/monomorphization/mod.rs b/crates/noirc_frontend/src/monomorphization/mod.rs index 86a0ca1f20c..4a04cb7b58e 100644 --- a/crates/noirc_frontend/src/monomorphization/mod.rs +++ b/crates/noirc_frontend/src/monomorphization/mod.rs @@ -1187,7 +1187,11 @@ impl<'interner> Monomorphizer<'interner> { /// Implements std::unsafe::zeroed by returning an appropriate zeroed /// ast literal or collection node for the given type. Note that for functions /// there is no obvious zeroed value so this should be considered unsafe to use. - fn zeroed_value_of_type(&mut self, typ: &ast::Type, location: noirc_errors::Location) -> ast::Expression { + fn zeroed_value_of_type( + &mut self, + typ: &ast::Type, + location: noirc_errors::Location, + ) -> ast::Expression { match typ { ast::Type::Field | ast::Type::Integer(..) => { ast::Expression::Literal(ast::Literal::Integer(0_u128.into(), typ.clone())) @@ -1218,9 +1222,9 @@ impl<'interner> Monomorphizer<'interner> { Box::new(zeroed_tuple), )) } - ast::Type::Tuple(fields) => { - ast::Expression::Tuple(vecmap(fields, |field| self.zeroed_value_of_type(field, location))) - } + ast::Type::Tuple(fields) => ast::Expression::Tuple(vecmap(fields, |field| { + self.zeroed_value_of_type(field, location) + })), ast::Type::Function(parameter_types, ret_type, env) => { self.create_zeroed_function(parameter_types, ret_type, env, location) } @@ -1234,7 +1238,12 @@ impl<'interner> Monomorphizer<'interner> { use crate::UnaryOp::MutableReference; let rhs = Box::new(self.zeroed_value_of_type(element, location)); let result_type = typ.clone(); - ast::Expression::Unary(ast::Unary { rhs, result_type, operator: MutableReference, location }) + ast::Expression::Unary(ast::Unary { + rhs, + result_type, + operator: MutableReference, + location, + }) } } }