cargo fmt + clippy

This commit is contained in:
collin 2022-08-03 14:52:05 -07:00
parent 7f636ca06d
commit 8fb2e60cb4
4 changed files with 8 additions and 14 deletions

View File

@ -14,8 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_span::sym;
use super::*;
use leo_span::sym;
/// An initializer for a single field / variable of a circuit initializer expression.
/// That is, in `Foo { bar: 42, baz }`, this is either `bar: 42`, or `baz`.
@ -55,14 +55,9 @@ pub struct CircuitExpression {
impl CircuitExpression {
/// Returns true if the record has all required fields and visibility.
pub fn check_record(&self) -> bool {
let has_member = |symbol| self
.members
.iter()
.any(|variable| variable.identifier.name == symbol);
let has_member = |symbol| self.members.iter().any(|variable| variable.identifier.name == symbol);
has_member(sym::owner)
&& has_member(sym::gates)
&& has_member(sym::_nonce)
has_member(sym::owner) && has_member(sym::gates) && has_member(sym::_nonce)
}
/// Returns the circuit as a record interface with visibility.
@ -80,7 +75,8 @@ impl CircuitExpression {
}
})
.collect::<Vec<_>>()
.join(", "))
.join(", ")
)
}
}

View File

@ -59,9 +59,7 @@ impl InputAst {
false => definition.value.to_string(),
true => match &definition.value {
// Print out the record interface with visibility.
Expression::Circuit(circuit_expression) => {
circuit_expression.to_record_string()
}
Expression::Circuit(circuit_expression) => circuit_expression.to_record_string(),
_ => panic!("Input error: Expected a circuit expression."),
},
},

View File

@ -264,7 +264,7 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Va
let package = handler.extend_if_error(Package::<Testnet3>::open(&directory).map_err(LeoError::Anyhow))?;
// Get the program process and check all instructions.
// handler.extend_if_error(package.get_process().map_err(LeoError::Anyhow))?;
handler.extend_if_error(package.get_process().map_err(LeoError::Anyhow))?;
}
let initial_ast = hash_file("/tmp/output/initial_ast.json");

View File

@ -17,8 +17,8 @@
use super::*;
use leo_errors::{ParserError, Result};
use snarkvm_console::{account::Address, network::Testnet3};
use leo_span::Symbol;
use snarkvm_console::{account::Address, network::Testnet3};
const INT_TYPES: &[Token] = &[
Token::I8,