From 5f39029e069c99b2003ee296d2607a470ddb677a Mon Sep 17 00:00:00 2001 From: Doris Benda Date: Mon, 7 Aug 2023 12:08:55 +0300 Subject: [PATCH] Apply linter --- concordium-std/src/impls.rs | 1 - concordium-std/src/types.rs | 8 +++----- examples/cis3-nft-sponsored-txs/src/lib.rs | 11 ++++++----- examples/cis3-nft-sponsored-txs/tests/test.rs | 5 ++++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/concordium-std/src/impls.rs b/concordium-std/src/impls.rs index 35844f16..5ccd1f51 100644 --- a/concordium-std/src/impls.rs +++ b/concordium-std/src/impls.rs @@ -2918,7 +2918,6 @@ where fn delete(mut self) { self.clear(); } } - impl Serial for HashSha2256 { fn serial(&self, out: &mut W) -> Result<(), W::Err> { self.0.serial(out) } } diff --git a/concordium-std/src/types.rs b/concordium-std/src/types.rs index b45fa828..6dd96de9 100644 --- a/concordium-std/src/types.rs +++ b/concordium-std/src/types.rs @@ -1,9 +1,7 @@ use crate::{ cell::UnsafeCell, marker::PhantomData, num::NonZeroU32, Cursor, HasStateApi, Serial, Vec, }; -use concordium_contracts_common::{ - AccountBalance, Amount, ParseError -}; +use concordium_contracts_common::{AccountBalance, Amount, ParseError}; use core::{fmt, str::FromStr}; // Re-export for backward compatibility. pub use concordium_contracts_common::ExchangeRates; @@ -695,13 +693,13 @@ pub type QueryContractBalanceResult = Result; /// A wrapper around [`Result`] that fixes the error variant to /// [`QueryAccountPublicKeysError`] and result to [`AccountPublicKeys`]. -pub type QueryAccountPublicKeysResult = Result; +pub type QueryAccountPublicKeysResult = + Result; /// A wrapper around [`Result`] that fixes the error variant to /// [`CheckAccountSignatureError`] and result to [`bool`]. pub type CheckAccountSignatureResult = Result; - /// A type representing the attributes, lazily acquired from the host. #[derive(Clone, Copy, Default)] pub struct AttributesCursor { diff --git a/examples/cis3-nft-sponsored-txs/src/lib.rs b/examples/cis3-nft-sponsored-txs/src/lib.rs index e7fac781..19483632 100644 --- a/examples/cis3-nft-sponsored-txs/src/lib.rs +++ b/examples/cis3-nft-sponsored-txs/src/lib.rs @@ -43,10 +43,11 @@ //! identities) and each credential has one (or several) public-private key //! pairs. The key/signature structures of an account are represented as //! two-level maps (e.g. BTreeMap> or BTreeMap>). The outer map has an `AccountThreshold` (number of credentials -//! needed to sign the transaction initiated by that account) and the inner map -//! has a `SignatureThreshold` (number of Ed25519Signatures needed for a +//! PublicKey>> or BTreeMap>). The outer map of `BTreeMap>` has an `AccountThreshold` (number of +//! credentials needed to sign the transaction initiated by that account) and +//! the inner map has a `SignatureThreshold` (number of Signatures needed for a //! specific credential so that this credential is considered to have signed the //! transaction initiated by that account). The CIS3 standard supports multi-sig //! accounts. But for simplicity, this contract supports only basic accounts @@ -344,7 +345,7 @@ type ContractError = Cis2Error; type ContractResult = Result; -/// Mapping CustomContractError to ContractError +/// Mapping account signature error to CustomContractError impl From for CustomContractError { fn from(e: CheckAccountSignatureError) -> Self { match e { diff --git a/examples/cis3-nft-sponsored-txs/tests/test.rs b/examples/cis3-nft-sponsored-txs/tests/test.rs index 0f243060..36beb03a 100644 --- a/examples/cis3-nft-sponsored-txs/tests/test.rs +++ b/examples/cis3-nft-sponsored-txs/tests/test.rs @@ -61,7 +61,10 @@ fn setup_chain_and_contract() -> (Chain, ContractInitSuccess) { inner_key_map.insert( KeyIndex(0u8), - VerifyKey::Ed25519VerifyKey(ed25519_dalek::PublicKey::from_bytes(&PUBLIC_KEY).unwrap()), + VerifyKey::Ed25519VerifyKey( + ed25519_dalek::PublicKey::from_bytes(&PUBLIC_KEY) + .expect("Should be able to create public key"), + ), ); let credential_public_keys = CredentialPublicKeys {