mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-24 07:48:04 +03:00
cargo +nightly clippy
This commit is contained in:
parent
cd53cba77a
commit
7745710dc4
@ -136,8 +136,8 @@ impl StatementError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn multiple_returns(span: Span) -> Self {
|
pub fn multiple_returns(span: Span) -> Self {
|
||||||
let message =
|
let message = "This function returns multiple times and produces unreachable circuits with undefined behavior."
|
||||||
format!("This function returns multiple times and produces unreachable circuits with undefined behavior.");
|
.to_string();
|
||||||
|
|
||||||
Self::new_from_span(message, span)
|
Self::new_from_span(message, span)
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,6 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
|
|
||||||
// Conditionally select a result based on returned indicators
|
// Conditionally select a result based on returned indicators
|
||||||
Self::conditionally_select_result(cs, function.output, results, &function.span)
|
Self::conditionally_select_result(cs, function.output, results, &function.span)
|
||||||
.map_err(|err| FunctionError::StatementError(err))
|
.map_err(FunctionError::StatementError)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,11 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Error if the function or one of its branches does not return.
|
// Error if the function or one of its branches does not return.
|
||||||
if let None = results.iter().find(|(indicator, _res)| get_indicator_value(indicator)) {
|
if results
|
||||||
|
.iter()
|
||||||
|
.find(|(indicator, _res)| get_indicator_value(indicator))
|
||||||
|
.is_none()
|
||||||
|
{
|
||||||
return Err(StatementError::no_returns(return_type, span.to_owned()));
|
return Err(StatementError::no_returns(return_type, span.to_owned()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
match &value {
|
match &value {
|
||||||
ConstrainedValue::Tuple(values) => {
|
ConstrainedValue::Tuple(values) => {
|
||||||
if !values.is_empty() {
|
if !values.is_empty() {
|
||||||
results.push((indicator.clone(), value));
|
results.push((*indicator, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => return Err(StatementError::unassigned(expression_string, span)),
|
_ => return Err(StatementError::unassigned(expression_string, span)),
|
||||||
|
Loading…
Reference in New Issue
Block a user