mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-22 04:27:25 +03:00
clippy: fix large_enum_variant
Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
parent
c4cdaed923
commit
ba9fc92229
@ -77,7 +77,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
function_scope,
|
||||
indicator,
|
||||
variable_name,
|
||||
range_or_expression,
|
||||
*range_or_expression,
|
||||
new_value,
|
||||
span,
|
||||
),
|
||||
|
@ -71,7 +71,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
declared_circuit_reference,
|
||||
indicator,
|
||||
variable,
|
||||
expression,
|
||||
*expression,
|
||||
span,
|
||||
)?;
|
||||
}
|
||||
@ -95,8 +95,8 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
||||
function_scope,
|
||||
indicator,
|
||||
index,
|
||||
start,
|
||||
stop,
|
||||
*start,
|
||||
*stop,
|
||||
statements,
|
||||
return_type,
|
||||
span,
|
||||
|
@ -48,7 +48,7 @@ use std::{
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum EdwardsGroupType {
|
||||
Constant(EdwardsAffine),
|
||||
Allocated(EdwardsBlsGadget),
|
||||
Allocated(Box<EdwardsBlsGadget>),
|
||||
}
|
||||
|
||||
impl GroupType<Fq> for EdwardsGroupType {
|
||||
@ -60,7 +60,7 @@ impl GroupType<Fq> for EdwardsGroupType {
|
||||
|
||||
fn to_allocated<CS: ConstraintSystem<Fq>>(&self, mut cs: CS, span: Span) -> Result<Self, GroupError> {
|
||||
self.allocated(cs.ns(|| format!("allocate affine point {}:{}", span.line, span.start)))
|
||||
.map(|result| EdwardsGroupType::Allocated(result))
|
||||
.map(|ebg| EdwardsGroupType::Allocated(Box::new(ebg)))
|
||||
.map_err(|error| GroupError::synthesis_error(error, span))
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ impl GroupType<Fq> for EdwardsGroupType {
|
||||
let result = <EdwardsBlsGadget as GroupGadget<GroupAffine<EdwardsParameters>, Fq>>::negate(group, cs)
|
||||
.map_err(|e| GroupError::negate_operation(e, span))?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(result))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(result)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,16 +90,16 @@ impl GroupType<Fq> for EdwardsGroupType {
|
||||
)
|
||||
.map_err(|e| GroupError::binary_operation("+".to_string(), e, span))?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(result))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(result)))
|
||||
}
|
||||
|
||||
(EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value))
|
||||
| (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => {
|
||||
Ok(EdwardsGroupType::Allocated(
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(
|
||||
allocated_value
|
||||
.add_constant(cs, constant_value)
|
||||
.map_err(|e| GroupError::binary_operation("+".to_string(), e, span))?,
|
||||
))
|
||||
)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -118,16 +118,16 @@ impl GroupType<Fq> for EdwardsGroupType {
|
||||
)
|
||||
.map_err(|e| GroupError::binary_operation("-".to_string(), e, span))?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(result))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(result)))
|
||||
}
|
||||
|
||||
(EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value))
|
||||
| (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => {
|
||||
Ok(EdwardsGroupType::Allocated(
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(
|
||||
allocated_value
|
||||
.sub_constant(cs, constant_value)
|
||||
.map_err(|e| GroupError::binary_operation("-".to_string(), e, span))?,
|
||||
))
|
||||
)))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,7 +316,7 @@ impl AllocGadget<GroupValue, Fq> for EdwardsGroupType {
|
||||
Self::alloc_helper(value_gen)
|
||||
})?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(value))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(value)))
|
||||
}
|
||||
|
||||
fn alloc_input<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<GroupValue>, CS: ConstraintSystem<Fq>>(
|
||||
@ -327,7 +327,7 @@ impl AllocGadget<GroupValue, Fq> for EdwardsGroupType {
|
||||
Self::alloc_helper(value_gen)
|
||||
})?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(value))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(value)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ impl CondSelectGadget<Fq> for EdwardsGroupType {
|
||||
let second_gadget = second.allocated(cs.ns(|| "second"))?;
|
||||
let result = EdwardsBlsGadget::conditionally_select(cs, cond, &first_gadget, &second_gadget)?;
|
||||
|
||||
Ok(EdwardsGroupType::Allocated(result))
|
||||
Ok(EdwardsGroupType::Allocated(Box::new(result)))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ use std::fmt;
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum Assignee {
|
||||
Identifier(Identifier),
|
||||
Array(Box<Assignee>, RangeOrExpression),
|
||||
Array(Box<Assignee>, Box<RangeOrExpression>),
|
||||
Tuple(Box<Assignee>, usize),
|
||||
CircuitField(Box<Assignee>, Identifier), // (circuit name, circuit field name)
|
||||
}
|
||||
@ -54,7 +54,7 @@ impl<'ast> From<AstAssignee<'ast>> for Assignee {
|
||||
.into_iter()
|
||||
.fold(variable, |acc, access| match access {
|
||||
AstAssigneeAccess::Array(array) => {
|
||||
Assignee::Array(Box::new(acc), RangeOrExpression::from(array.expression))
|
||||
Assignee::Array(Box::new(acc), Box::new(RangeOrExpression::from(array.expression)))
|
||||
}
|
||||
AstAssigneeAccess::Tuple(tuple) => {
|
||||
Assignee::Tuple(Box::new(acc), Expression::get_count_from_ast(tuple.number))
|
||||
|
@ -36,9 +36,9 @@ use std::fmt;
|
||||
pub enum Statement {
|
||||
Return(Expression, Span),
|
||||
Definition(Declare, Variables, Vec<Expression>, Span),
|
||||
Assign(Assignee, Expression, Span),
|
||||
Assign(Assignee, Box<Expression>, Span),
|
||||
Conditional(ConditionalStatement, Span),
|
||||
Iteration(Identifier, Expression, Expression, Vec<Statement>, Span),
|
||||
Iteration(Identifier, Box<Expression>, Box<Expression>, Vec<Statement>, Span),
|
||||
Console(ConsoleFunctionCall),
|
||||
Expression(Expression, Span),
|
||||
}
|
||||
@ -78,7 +78,7 @@ impl<'ast> From<AssignStatement<'ast>> for Statement {
|
||||
match statement.assign {
|
||||
AssignOperation::Assign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::from(statement.expression),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
operation_assign => {
|
||||
@ -88,47 +88,47 @@ impl<'ast> From<AssignStatement<'ast>> for Statement {
|
||||
match operation_assign {
|
||||
AssignOperation::AddAssign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::Add(
|
||||
Box::new(Expression::Add(
|
||||
Box::new(converted),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span.clone()),
|
||||
),
|
||||
)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
AssignOperation::SubAssign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::Sub(
|
||||
Box::new(Expression::Sub(
|
||||
Box::new(converted),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span.clone()),
|
||||
),
|
||||
)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
AssignOperation::MulAssign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::Mul(
|
||||
Box::new(Expression::Mul(
|
||||
Box::new(converted),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span.clone()),
|
||||
),
|
||||
)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
AssignOperation::DivAssign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::Div(
|
||||
Box::new(Expression::Div(
|
||||
Box::new(converted),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span.clone()),
|
||||
),
|
||||
)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
AssignOperation::PowAssign(ref _assign) => Statement::Assign(
|
||||
Assignee::from(statement.assignee),
|
||||
Expression::Pow(
|
||||
Box::new(Expression::Pow(
|
||||
Box::new(converted),
|
||||
Box::new(Expression::from(statement.expression)),
|
||||
Span::from(statement.span.clone()),
|
||||
),
|
||||
)),
|
||||
Span::from(statement.span),
|
||||
),
|
||||
AssignOperation::Assign(ref _assign) => unimplemented!("cannot assign twice to assign statement"),
|
||||
@ -142,8 +142,8 @@ impl<'ast> From<ForStatement<'ast>> for Statement {
|
||||
fn from(statement: ForStatement<'ast>) -> Self {
|
||||
Statement::Iteration(
|
||||
Identifier::from(statement.index),
|
||||
Expression::from(statement.start),
|
||||
Expression::from(statement.stop),
|
||||
Box::new(Expression::from(statement.start)),
|
||||
Box::new(Expression::from(statement.stop)),
|
||||
statement
|
||||
.statements
|
||||
.into_iter()
|
||||
|
Loading…
Reference in New Issue
Block a user