run cargo clippy

This commit is contained in:
Mazdak Farrokhzad 2022-07-12 16:43:03 +02:00
parent dab6629ac0
commit ce7ac0b443
4 changed files with 4 additions and 12 deletions

View File

@ -71,14 +71,6 @@ impl Type {
_ => false,
}
}
/// Returns true if the type is a tuple.
pub fn is_tuple(&self) -> bool {
match self {
Type::Tuple(_) => true,
_ => false,
}
}
}
impl fmt::Display for Type {

View File

@ -59,7 +59,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
// Ensure there are no nested tuples in the return type.
if let Type::Tuple(tys) = &input.output {
for ty in &tys.0 {
self.assert_not_tuple(input.span, &ty);
self.assert_not_tuple(input.span, ty);
}
}
@ -108,7 +108,7 @@ impl<'a> ProgramVisitor<'a> for TypeChecker<'a> {
// Ensure there are no tuple typed members.
for CircuitMember::CircuitVariable(v, type_) in input.members.iter() {
self.assert_not_tuple(v.span, &type_);
self.assert_not_tuple(v.span, type_);
}
}
}

View File

@ -50,7 +50,7 @@ impl<'a> StatementVisitor<'a> for TypeChecker<'a> {
VariableSymbol {
type_: input.type_.clone(),
span: input.span(),
declaration: declaration.clone(),
declaration,
},
) {
self.handler.emit_err(err);

View File

@ -322,7 +322,7 @@ impl<'a> TypeChecker<'a> {
/// Emits an error if the type is a tuple.
pub(crate) fn assert_not_tuple(&self, span: Span, type_: &Type) {
if type_.is_tuple() {
if matches!(type_, Type::Tuple(_)) {
self.emit_err(TypeCheckerError::tuple_not_allowed(span))
}
}