diff --git a/crates/noirc_frontend/src/hir/type_check/expr.rs b/crates/noirc_frontend/src/hir/type_check/expr.rs index 3a4c94ac3f4..27b7a1d5e84 100644 --- a/crates/noirc_frontend/src/hir/type_check/expr.rs +++ b/crates/noirc_frontend/src/hir/type_check/expr.rs @@ -11,7 +11,6 @@ use crate::{ types::Type, }, node_interner::{DefinitionKind, ExprId, FuncId}, - token::SecondaryAttribute::Deprecated, Shared, Signedness, TypeBinding, TypeVariableKind, UnaryOp, }; @@ -26,10 +25,10 @@ impl<'interner> TypeChecker<'interner> { self.interner.try_definition(id).map(|def| &def.kind) { let meta = self.interner.function_meta(func_id); - if let note = meta.attributes.get_deprecated_note() { + if let Some(note) = meta.attributes.get_deprecated_note() { self.errors.push(TypeCheckError::CallDeprecated { name: self.interner.definition_name(id).to_string(), - note, // TODO(MD): remove clone + note, span: location.span, }); } diff --git a/crates/noirc_frontend/src/hir_def/function.rs b/crates/noirc_frontend/src/hir_def/function.rs index 0094e3b9631..c552100c919 100644 --- a/crates/noirc_frontend/src/hir_def/function.rs +++ b/crates/noirc_frontend/src/hir_def/function.rs @@ -99,9 +99,8 @@ pub struct FuncMeta { pub module_id: ModuleId, /// A function's attributes are the `#[...]` items above the function - /// definition, if any. Currently, this is limited to a maximum of only one - /// Attribute per function. - /// TODO: edit the above + /// definition. + /// Primary Attributes will alter the function kind, secondary attributes do not pub attributes: Attributes, /// This function's type in its contract. diff --git a/crates/noirc_frontend/src/lexer/token.rs b/crates/noirc_frontend/src/lexer/token.rs index 0a06b4d090b..c2e863696d6 100644 --- a/crates/noirc_frontend/src/lexer/token.rs +++ b/crates/noirc_frontend/src/lexer/token.rs @@ -363,9 +363,9 @@ impl Attributes { } /// Returns note if a deprecated secondary attribute is found - pub fn get_deprecated_note(&self) -> Option { + pub fn get_deprecated_note(&self) -> Option> { self.secondary.iter().find_map(|attr| match attr { - SecondaryAttribute::Deprecated(note) => note.clone(), + SecondaryAttribute::Deprecated(note) => Some(note.clone()), _ => None, }) } diff --git a/crates/noirc_frontend/src/parser/parser.rs b/crates/noirc_frontend/src/parser/parser.rs index 779f2d2845d..e9b6a9367fc 100644 --- a/crates/noirc_frontend/src/parser/parser.rs +++ b/crates/noirc_frontend/src/parser/parser.rs @@ -434,8 +434,8 @@ fn validate_attributes( if attributes.is_none() { return Attributes::empty(); } - // TODO: zero copy possilbe? - let attrs = attributes.unwrap().clone(); + + let attrs = attributes.unwrap(); let mut primary = None; let mut secondary = Vec::new(); @@ -449,7 +449,7 @@ fn validate_attributes( span, )); } - primary = Some(attr) + primary = Some(attr); } Attribute::Secondary(attr) => secondary.push(attr), }