Skip to content

Commit

Permalink
chore: Run cargo fmt (#2455)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Aug 28, 2023
1 parent 168e0db commit b1ccd71
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
7 changes: 6 additions & 1 deletion crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down
3 changes: 1 addition & 2 deletions crates/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
});
Expand Down
6 changes: 5 additions & 1 deletion crates/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions crates/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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)
}
Expand All @@ -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,
})
}
}
}
Expand Down

0 comments on commit b1ccd71

Please sign in to comment.