From 71df01257daa7e838a11e50d1b1aa327a7189f42 Mon Sep 17 00:00:00 2001 From: collin Date: Mon, 25 Jan 2021 12:07:45 -0500 Subject: [PATCH 1/2] cargo +nightly clippy --- asg/src/expression/binary.rs | 5 +---- asg/src/lib.rs | 2 +- asg/src/statement/assign.rs | 4 ++-- asg/src/statement/conditional.rs | 4 +--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/asg/src/expression/binary.rs b/asg/src/expression/binary.rs index f3cb8eb112..4228b92c59 100644 --- a/asg/src/expression/binary.rs +++ b/asg/src/expression/binary.rs @@ -176,10 +176,7 @@ impl FromAst for BinaryExpression { BinaryOperationClass::Numeric => match left_type { Some(Type::Integer(_)) => (), Some(Type::Group) | Some(Type::Field) - if value.op == BinaryOperation::Add || value.op == BinaryOperation::Sub => - { - () - } + if value.op == BinaryOperation::Add || value.op == BinaryOperation::Sub => {} Some(Type::Field) if value.op == BinaryOperation::Mul || value.op == BinaryOperation::Div => (), type_ => { return Err(AsgConvertError::unexpected_type( diff --git a/asg/src/lib.rs b/asg/src/lib.rs index 9d3d9d8c82..8eee7f4fb3 100644 --- a/asg/src/lib.rs +++ b/asg/src/lib.rs @@ -13,7 +13,7 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . - +#![allow(clippy::from_over_into)] #[macro_use] extern crate thiserror; diff --git a/asg/src/statement/assign.rs b/asg/src/statement/assign.rs index 91eaf2919e..197f22b962 100644 --- a/asg/src/statement/assign.rs +++ b/asg/src/statement/assign.rs @@ -102,7 +102,7 @@ impl FromAst for Arc { .as_ref() .map( |left: &leo_ast::Expression| -> Result, AsgConvertError> { - Ok(Arc::::from_ast(scope, left, index_type.clone())?) + Arc::::from_ast(scope, left, index_type.clone()) }, ) .transpose()?; @@ -110,7 +110,7 @@ impl FromAst for Arc { .as_ref() .map( |right: &leo_ast::Expression| -> Result, AsgConvertError> { - Ok(Arc::::from_ast(scope, right, index_type)?) + Arc::::from_ast(scope, right, index_type) }, ) .transpose()?; diff --git a/asg/src/statement/conditional.rs b/asg/src/statement/conditional.rs index fdba1a9dc3..9175f974d2 100644 --- a/asg/src/statement/conditional.rs +++ b/asg/src/statement/conditional.rs @@ -46,9 +46,7 @@ impl FromAst for ConditionalStatement { let next = statement .next .as_deref() - .map(|next| -> Result, AsgConvertError> { - Ok(Arc::::from_ast(scope, next, None)?) - }) + .map(|next| -> Result, AsgConvertError> { Arc::::from_ast(scope, next, None) }) .transpose()?; Ok(ConditionalStatement { From 0c9b12d545cd2d84f5581cb09fa57b5a71f3ccbc Mon Sep 17 00:00:00 2001 From: collin Date: Mon, 25 Jan 2021 15:49:51 -0500 Subject: [PATCH 2/2] allow clippy::unused_unit in binary.rs --- asg/src/expression/binary.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asg/src/expression/binary.rs b/asg/src/expression/binary.rs index bb4ccbef13..21637b121a 100644 --- a/asg/src/expression/binary.rs +++ b/asg/src/expression/binary.rs @@ -176,7 +176,10 @@ impl FromAst for BinaryExpression { BinaryOperationClass::Numeric => match left_type { Some(Type::Integer(_)) => (), Some(Type::Group) | Some(Type::Field) - if value.op == BinaryOperation::Add || value.op == BinaryOperation::Sub => {} + if value.op == BinaryOperation::Add || value.op == BinaryOperation::Sub => + { + () + } Some(Type::Field) if value.op == BinaryOperation::Mul || value.op == BinaryOperation::Div => (), type_ => { return Err(AsgConvertError::unexpected_type(