clippy: unbox some arguments

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-10-21 11:16:24 +02:00
parent 5e4f799685
commit 7443bffc00
5 changed files with 18 additions and 24 deletions

View File

@ -39,12 +39,12 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope: &str,
function_scope: &str,
expected_type: Option<Type>,
circuit_identifier: Box<Expression>,
circuit_identifier: Expression,
circuit_member: Identifier,
span: Span,
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
// access a circuit member using the `self` keyword
if let Expression::Identifier(ref identifier) = *circuit_identifier {
if let Expression::Identifier(ref identifier) = circuit_identifier {
if identifier.is_self() {
let self_file_scope = new_scope(&file_scope, &identifier.name);
let self_function_scope = new_scope(&self_file_scope, &identifier.name);
@ -56,17 +56,11 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
}
}
let (circuit_name, members) = match self.enforce_operand(
cs,
file_scope,
function_scope,
expected_type,
*circuit_identifier,
&span,
)? {
ConstrainedValue::CircuitExpression(name, members) => (name, members),
value => return Err(ExpressionError::undefined_circuit(value.to_string(), span)),
};
let (circuit_name, members) =
match self.enforce_operand(cs, file_scope, function_scope, expected_type, circuit_identifier, &span)? {
ConstrainedValue::CircuitExpression(name, members) => (name, members),
value => return Err(ExpressionError::undefined_circuit(value.to_string(), span)),
};
let matched_member = members.clone().into_iter().find(|member| member.0 == circuit_member);

View File

@ -32,12 +32,12 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope: &str,
function_scope: &str,
expected_type: Option<Type>,
circuit_identifier: Box<Expression>,
circuit_identifier: Expression,
circuit_member: Identifier,
span: Span,
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
// Get defined circuit
let circuit = match *circuit_identifier {
let circuit = match circuit_identifier {
Expression::Identifier(identifier) => {
// Use the "Self" keyword to access a static circuit function
if identifier.is_self() {

View File

@ -261,7 +261,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
self.enforce_tuple(cs, file_scope, function_scope, expected_type, tuple, span)
}
Expression::TupleAccess(tuple, index, span) => {
self.enforce_tuple_access(cs, file_scope, function_scope, expected_type, tuple, index, &span)
self.enforce_tuple_access(cs, file_scope, function_scope, expected_type, *tuple, index, &span)
}
// Circuits
@ -273,7 +273,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope,
function_scope,
expected_type,
circuit_variable,
*circuit_variable,
circuit_member,
span,
),
@ -283,7 +283,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope,
function_scope,
expected_type,
circuit_identifier,
*circuit_identifier,
circuit_member,
span,
),
@ -294,7 +294,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope,
function_scope,
expected_type,
function,
*function,
arguments,
span,
),

View File

@ -32,11 +32,11 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope: &str,
function_scope: &str,
expected_type: Option<Type>,
function: Box<Expression>,
function: Expression,
arguments: Vec<Expression>,
span: Span,
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
let (declared_circuit_reference, function_value) = match *function {
let (declared_circuit_reference, function_value) = match function {
Expression::CircuitMemberAccess(circuit_identifier, circuit_member, span) => {
// Call a circuit function that can mutate self.
@ -51,7 +51,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope,
function_scope,
expected_type,
circuit_identifier,
*circuit_identifier,
circuit_member,
span,
)?,

View File

@ -32,11 +32,11 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
file_scope: &str,
function_scope: &str,
expected_type: Option<Type>,
tuple: Box<Expression>,
tuple: Expression,
index: usize,
span: &Span,
) -> Result<ConstrainedValue<F, G>, ExpressionError> {
let tuple = match self.enforce_operand(cs, file_scope, function_scope, expected_type, *tuple, &span)? {
let tuple = match self.enforce_operand(cs, file_scope, function_scope, expected_type, tuple, &span)? {
ConstrainedValue::Tuple(tuple) => tuple,
value => return Err(ExpressionError::undefined_array(value.to_string(), span.to_owned())),
};