From ecc1fff7fd49b12c1d6fa84e5572d0e39b3651ee Mon Sep 17 00:00:00 2001 From: collin <16715212+collinc97@users.noreply.github.com> Date: Sat, 2 Jul 2022 14:08:17 -0700 Subject: [PATCH] cargo fmt --- .../src/type_checker/check_expressions.rs | 1 - .../passes/src/type_checker/check_program.rs | 29 +++++++------------ leo/span/src/dropless.rs | 1 - leo/span/src/span.rs | 1 - leo/span/src/symbol.rs | 1 - 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/compiler/passes/src/type_checker/check_expressions.rs b/compiler/passes/src/type_checker/check_expressions.rs index 67f41ca6d1..c7b740f8ff 100644 --- a/compiler/passes/src/type_checker/check_expressions.rs +++ b/compiler/passes/src/type_checker/check_expressions.rs @@ -395,7 +395,6 @@ impl<'a> ExpressionVisitor<'a> for TypeChecker<'a> { } } - fn visit_unary(&mut self, input: &'a UnaryExpression, destination: &Self::AdditionalInput) -> Self::Output { match input.op { UnaryOperation::Abs => { diff --git a/compiler/passes/src/type_checker/check_program.rs b/compiler/passes/src/type_checker/check_program.rs index b7e16637c4..50ba9e8fbd 100644 --- a/compiler/passes/src/type_checker/check_program.rs +++ b/compiler/passes/src/type_checker/check_program.rs @@ -18,8 +18,8 @@ use crate::{Declaration, TypeChecker, VariableSymbol}; use leo_ast::*; use leo_errors::TypeCheckerError; -use std::collections::HashSet; use leo_span::sym; +use std::collections::HashSet; impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { fn visit_function(&mut self, input: &'a Function) { @@ -54,12 +54,11 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { // Check for conflicting circuit member names. let mut used = HashSet::new(); if !input.members.iter().all(|member| used.insert(member.name())) { - self.handler - .emit_err(if input.is_record { - TypeCheckerError::duplicate_record_variable(input.name(), input.span()).into() - } else { - TypeCheckerError::duplicate_circuit_member(input.name(), input.span()).into() - }); + self.handler.emit_err(if input.is_record { + TypeCheckerError::duplicate_record_variable(input.name(), input.span()).into() + } else { + TypeCheckerError::duplicate_circuit_member(input.name(), input.span()).into() + }); } // For records, enforce presence of `owner: Address` and `balance: u64` members. @@ -67,22 +66,16 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> { let check_has_field = |need, expected_ty: Type| match input .members .iter() - .find_map(|CircuitMember::CircuitVariable(v, t) | (v.name == need).then(|| (v, t))) + .find_map(|CircuitMember::CircuitVariable(v, t)| (v.name == need).then(|| (v, t))) { Some((_, actual_ty)) if expected_ty.eq_flat(actual_ty) => {} // All good, found + right type! Some((field, _)) => { - self.handler.emit_err(TypeCheckerError::record_var_wrong_type( - field, - expected_ty, - input.span(), - ).into()); + self.handler + .emit_err(TypeCheckerError::record_var_wrong_type(field, expected_ty, input.span()).into()); } None => { - self.handler.emit_err(TypeCheckerError::required_record_variable( - need, - expected_ty, - input.span(), - ).into()); + self.handler + .emit_err(TypeCheckerError::required_record_variable(need, expected_ty, input.span()).into()); } }; check_has_field(sym::owner, Type::Address); diff --git a/leo/span/src/dropless.rs b/leo/span/src/dropless.rs index 06830cdb2a..376cb8f4da 100644 --- a/leo/span/src/dropless.rs +++ b/leo/span/src/dropless.rs @@ -16,7 +16,6 @@ // Copyright Rust project developers under MIT or APACHE-2.0. - use core::alloc::Layout; use core::cell::{Cell, RefCell}; use core::mem::{self, MaybeUninit}; diff --git a/leo/span/src/span.rs b/leo/span/src/span.rs index 645189a456..7dff0ce0dc 100644 --- a/leo/span/src/span.rs +++ b/leo/span/src/span.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . - //! Defines the `Span` type used to track where code comes from. use core::ops::{Add, Sub}; diff --git a/leo/span/src/symbol.rs b/leo/span/src/symbol.rs index 5f8cb03f30..868dd58527 100644 --- a/leo/span/src/symbol.rs +++ b/leo/span/src/symbol.rs @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with the Leo library. If not, see . - use crate::dropless::DroplessArena; use crate::source_map::SourceMap;