From 2a57adbd7e2531ce2ae26824f9f8ada800a09e44 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Fri, 16 Dec 2022 14:04:12 +0000 Subject: [PATCH 1/5] Apply clippy suggestions --- crates/e2e/macro/src/codegen.rs | 4 +--- crates/engine/src/test_api.rs | 4 ++-- crates/env/src/lib.rs | 1 - crates/ink/codegen/src/generator/events.rs | 2 +- crates/storage/src/lib.rs | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/e2e/macro/src/codegen.rs b/crates/e2e/macro/src/codegen.rs index ecba9cd8a1a..85a10976684 100644 --- a/crates/e2e/macro/src/codegen.rs +++ b/crates/e2e/macro/src/codegen.rs @@ -110,9 +110,7 @@ impl InkE2ETest { ); let contracts = - already_built_contracts - .iter() - .map(|(_manifest_path, bundle_path)| { + already_built_contracts.values().map(|bundle_path| { quote! { #bundle_path } }); diff --git a/crates/engine/src/test_api.rs b/crates/engine/src/test_api.rs index 6b3228fa30f..2d6703d7b20 100644 --- a/crates/engine/src/test_api.rs +++ b/crates/engine/src/test_api.rs @@ -188,12 +188,12 @@ impl Engine { /// Returns the total number of reads executed. pub fn count_reads(&self) -> usize { - self.debug_info.count_reads.iter().map(|(_, v)| v).sum() + self.debug_info.count_reads.values().sum() } /// Returns the total number of writes executed. pub fn count_writes(&self) -> usize { - self.debug_info.count_writes.iter().map(|(_, v)| v).sum() + self.debug_info.count_writes.values().sum() } /// Sets a caller for the next call. diff --git a/crates/env/src/lib.rs b/crates/env/src/lib.rs index f04a61306f9..e9d9be7dcf1 100644 --- a/crates/env/src/lib.rs +++ b/crates/env/src/lib.rs @@ -29,7 +29,6 @@ missing_docs, bad_style, bare_trait_objects, - const_err, improper_ctypes, non_shorthand_field_patterns, no_mangle_generic_items, diff --git a/crates/ink/codegen/src/generator/events.rs b/crates/ink/codegen/src/generator/events.rs index c329ad81cf3..62344eab8fb 100644 --- a/crates/ink/codegen/src/generator/events.rs +++ b/crates/ink/codegen/src/generator/events.rs @@ -223,7 +223,7 @@ impl<'a> Events<'a> { )) }; // Anonymous events require 1 fewer topics since they do not include their signature. - let anonymous_topics_offset = if event.anonymous { 0 } else { 1 }; + let anonymous_topics_offset = usize::from(!event.anonymous); let remaining_topics_ty = match len_topics + anonymous_topics_offset { 0 => quote_spanned!(span=> ::ink::env::topics::state::NoRemainingTopics), n => quote_spanned!(span=> [::ink::env::topics::state::HasRemainingTopics; #n]), diff --git a/crates/storage/src/lib.rs b/crates/storage/src/lib.rs index d9971535a3a..38a417cca5b 100644 --- a/crates/storage/src/lib.rs +++ b/crates/storage/src/lib.rs @@ -29,7 +29,6 @@ missing_docs, bad_style, bare_trait_objects, - const_err, improper_ctypes, non_shorthand_field_patterns, no_mangle_generic_items, From 23338ac7169772c68b584d79205602433f2245d8 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Fri, 16 Dec 2022 14:10:23 +0000 Subject: [PATCH 2/5] fmt --- crates/e2e/macro/src/codegen.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/e2e/macro/src/codegen.rs b/crates/e2e/macro/src/codegen.rs index 85a10976684..6f1bf2161c2 100644 --- a/crates/e2e/macro/src/codegen.rs +++ b/crates/e2e/macro/src/codegen.rs @@ -109,10 +109,9 @@ impl InkE2ETest { "built contract artifacts must exist here" ); - let contracts = - already_built_contracts.values().map(|bundle_path| { - quote! { #bundle_path } - }); + let contracts = already_built_contracts.values().map(|bundle_path| { + quote! { #bundle_path } + }); quote! { #( #attrs )* From 00fa8f8efec8a4072c0dea3361e33b9af48ec0b3 Mon Sep 17 00:00:00 2001 From: SkymanOne Date: Fri, 16 Dec 2022 22:34:57 +0000 Subject: [PATCH 3/5] apply clippy suggestions --- crates/metadata/src/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/metadata/src/tests.rs b/crates/metadata/src/tests.rs index 60857877529..c539ffc377b 100644 --- a/crates/metadata/src/tests.rs +++ b/crates/metadata/src/tests.rs @@ -122,7 +122,7 @@ fn spec_contract_json() { let mut registry = Registry::new(); // when - let json = serde_json::to_value(&contract.into_portable(&mut registry)).unwrap(); + let json = serde_json::to_value(contract.into_portable(&mut registry)).unwrap(); // then assert_eq!( From f9b767bdc52591df5acf72e457d1cd4c467ba661 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Fri, 16 Dec 2022 17:48:30 -0500 Subject: [PATCH 4/5] Check build using `stating` image --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a77ca824997..5d5f394a568 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,7 @@ variables: CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}" # CI_IMAGE is changed to "-:staging" when the CI image gets rebuilt # read more https://github.com/paritytech/scripts/pull/244 - CI_IMAGE: "paritytech/ink-ci-linux:production" + CI_IMAGE: "paritytech/ink-ci-linux:staging" PURELY_STD_CRATES: "ink/codegen metadata engine" ALSO_WASM_CRATES: "env storage storage/traits allocator prelude primitives ink ink/macro ink/ir" ALL_CRATES: "${PURELY_STD_CRATES} ${ALSO_WASM_CRATES}" From 44ea18457c20c2cece161d74f62b0ad4c45aa540 Mon Sep 17 00:00:00 2001 From: Hernando Castano Date: Fri, 16 Dec 2022 18:14:37 -0500 Subject: [PATCH 5/5] Revert "Check build using `stating` image" This reverts commit f9b767bdc52591df5acf72e457d1cd4c467ba661. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d5f394a568..a77ca824997 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -28,7 +28,7 @@ variables: CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}" # CI_IMAGE is changed to "-:staging" when the CI image gets rebuilt # read more https://github.com/paritytech/scripts/pull/244 - CI_IMAGE: "paritytech/ink-ci-linux:staging" + CI_IMAGE: "paritytech/ink-ci-linux:production" PURELY_STD_CRATES: "ink/codegen metadata engine" ALSO_WASM_CRATES: "env storage storage/traits allocator prelude primitives ink ink/macro ink/ir" ALL_CRATES: "${PURELY_STD_CRATES} ${ALSO_WASM_CRATES}"