From dda80d9bc444b5d723b348874655b063ecb8e04e Mon Sep 17 00:00:00 2001 From: thunkar Date: Fri, 22 Mar 2024 12:40:24 +0000 Subject: [PATCH] clippy pass --- .../aztec_macros/src/transforms/storage.rs | 8 ++--- .../noirc_frontend/src/hir/def_map/mod.rs | 34 +++++++------------ noir/noir-repo/tooling/noirc_abi/src/lib.rs | 2 +- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/noir/noir-repo/aztec_macros/src/transforms/storage.rs b/noir/noir-repo/aztec_macros/src/transforms/storage.rs index 833fc4e05a80..9ba1bd298122 100644 --- a/noir/noir-repo/aztec_macros/src/transforms/storage.rs +++ b/noir/noir-repo/aztec_macros/src/transforms/storage.rs @@ -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 { diff --git a/noir/noir-repo/compiler/noirc_frontend/src/hir/def_map/mod.rs b/noir/noir-repo/compiler/noirc_frontend/src/hir/def_map/mod.rs index 1cd91db8ce40..dea5c3180c4f 100644 --- a/noir/noir-repo/compiler/noirc_frontend/src/hir/def_map/mod.rs +++ b/noir/noir-repo/compiler/noirc_frontend/src/hir/def_map/mod.rs @@ -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); diff --git a/noir/noir-repo/tooling/noirc_abi/src/lib.rs b/noir/noir-repo/tooling/noirc_abi/src/lib.rs index 1081b47d19ac..b73af1ccff88 100644 --- a/noir/noir-repo/tooling/noirc_abi/src/lib.rs +++ b/noir/noir-repo/tooling/noirc_abi/src/lib.rs @@ -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"), },