Skip to content

Commit

Permalink
fix: minor doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Sep 2, 2023
1 parent 53be3f1 commit f8c2c2b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions crates/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use crate::{
types::Type,
},
node_interner::{DefinitionKind, ExprId, FuncId},
token::SecondaryAttribute::Deprecated,
Shared, Signedness, TypeBinding, TypeVariableKind, UnaryOp,
};

Expand All @@ -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,
});
}
Expand Down
5 changes: 2 additions & 3 deletions crates/noirc_frontend/src/hir_def/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions crates/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ impl Attributes {
}

/// Returns note if a deprecated secondary attribute is found
pub fn get_deprecated_note(&self) -> Option<String> {
pub fn get_deprecated_note(&self) -> Option<Option<String>> {
self.secondary.iter().find_map(|attr| match attr {
SecondaryAttribute::Deprecated(note) => note.clone(),
SecondaryAttribute::Deprecated(note) => Some(note.clone()),
_ => None,
})
}
Expand Down
6 changes: 3 additions & 3 deletions crates/noirc_frontend/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -449,7 +449,7 @@ fn validate_attributes(
span,
));
}
primary = Some(attr)
primary = Some(attr);
}
Attribute::Secondary(attr) => secondary.push(attr),
}
Expand Down

0 comments on commit f8c2c2b

Please sign in to comment.