Skip to content

Commit

Permalink
Build fix and cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ymadzhunkov committed Aug 29, 2023
1 parent 28a3aaa commit 2ef48e2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
15 changes: 10 additions & 5 deletions crates/noirc_frontend/src/ast/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,11 +638,7 @@ impl FunctionDefinition {
let p = parameters
.iter()
.map(|(ident, unresolved_type)| {
(
Pattern::Identifier(ident.clone()),
unresolved_type.clone(),
Visibility::Private,
)
(Pattern::Identifier(ident.clone()), unresolved_type.clone(), Visibility::Private)
})
.collect();
FunctionDefinition {
Expand Down Expand Up @@ -692,6 +688,15 @@ impl Display for FunctionDefinition {
}
}

impl FunctionReturnType {
pub fn get_type(&self) -> &UnresolvedType {
match self {
FunctionReturnType::Default(_span) => &UnresolvedType::Unit,
FunctionReturnType::Ty(typ, _span) => typ,
}
}
}

impl Display for FunctionReturnType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down
10 changes: 0 additions & 10 deletions crates/noirc_frontend/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,6 @@ impl UnresolvedTypeData {
}
}

impl FunctionReturnType {
pub fn get_type(&self) -> &UnresolvedType {
match item {
FunctionReturnType::Default(_span) => &UnresolvedType::Unit,
FunctionReturnType::Ty(typ, _span) => typ,
}
}
}
}

#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
pub enum Signedness {
Unsigned,
Expand Down
4 changes: 1 addition & 3 deletions crates/noirc_frontend/src/hir/def_collector/dc_mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ fn check_trait_method_implementation_return_type(
impl_method: &NoirFunction,
trait_name: &str,
) -> Result<(), DefCollectorErrorKind> {
if UnresolvedType::from_func_return_type(expected_return_type)
== UnresolvedType::from_func_return_type(&impl_method.def.return_type)
{
if expected_return_type.get_type() == impl_method.def.return_type.get_type() {
Ok(())
} else {
Err(DefCollectorErrorKind::MismatchTraitImplementationReturnType {
Expand Down

0 comments on commit 2ef48e2

Please sign in to comment.