Skip to content

Commit

Permalink
clippy pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunkar committed Mar 22, 2024
1 parent 4a240d9 commit dda80d9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
8 changes: 2 additions & 6 deletions noir/noir-repo/aztec_macros/src/transforms/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ pub fn check_for_storage_definition(
let result: Vec<&NoirStruct> = module
.types
.iter()
.filter_map(|r#struct| {
if r#struct.attributes.iter().any(|attr| is_custom_attribute(attr, "aztec(storage)")) {
Some(r#struct)
} else {
None
}
.filter(|r#struct| {
r#struct.attributes.iter().any(|attr| is_custom_attribute(attr, "aztec(storage)"))
})
.collect();
if result.len() > 1 {
Expand Down
34 changes: 13 additions & 21 deletions noir/noir-repo/compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,36 +234,28 @@ impl CrateDefMap {

interner.get_all_globals().iter().for_each(|global_info| {
interner.global_attributes(&global_info.id).iter().for_each(|attr| {
match attr {
SecondaryAttribute::Abi(tag) => {
if let Some(tagged) = outputs.globals.get_mut(tag) {
tagged.push(global_info.id)
} else {
outputs
.globals
.insert(tag.to_string(), vec![global_info.id]);
}
if let SecondaryAttribute::Abi(tag) = attr {
if let Some(tagged) = outputs.globals.get_mut(tag) {
tagged.push(global_info.id);
} else {
outputs.globals.insert(tag.to_string(), vec![global_info.id]);
}
_ => (),
}
})
});
});

module.type_definitions().for_each(|id| match id {
ModuleDefId::TypeId(struct_id) => interner
.struct_attributes(&struct_id)
.iter()
.for_each(|attr| match attr {
SecondaryAttribute::Abi(tag) => {
module.type_definitions().for_each(|id| {
if let ModuleDefId::TypeId(struct_id) = id {
interner.struct_attributes(&struct_id).iter().for_each(|attr| {
if let SecondaryAttribute::Abi(tag) = attr {
if let Some(tagged) = outputs.structs.get_mut(tag) {
tagged.push(struct_id)
tagged.push(struct_id);
} else {
outputs.structs.insert(tag.to_string(), vec![struct_id]);
}
}
_ => (),
}),
_ => (),
});
}
});

let name = self.get_module_path(id, module.parent);
Expand Down
2 changes: 1 addition & 1 deletion noir/noir-repo/tooling/noirc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ impl AbiValue {
HirLiteral::Str(value) => Self::String { value },
HirLiteral::Integer(field, sign) => {
let value = field.to_i128();
Self::Integer { value: if sign { -1 * value } else { value } }
Self::Integer { value: if sign { -value } else { value } }
}
_ => unreachable!("Literal cannot be used in the abi"),
},
Expand Down

0 comments on commit dda80d9

Please sign in to comment.