From be63c636c1b3d221cdb1ee5348dbe2b33c7a80ef Mon Sep 17 00:00:00 2001 From: ascjones Date: Wed, 9 Mar 2022 12:18:15 +0000 Subject: [PATCH] Fix clippy suggestions --- src/cmd/extrinsics/instantiate.rs | 6 +++--- src/cmd/extrinsics/transcode/encode.rs | 4 ++-- src/cmd/extrinsics/upload.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cmd/extrinsics/instantiate.rs b/src/cmd/extrinsics/instantiate.rs index 58793ef5..e670a1e6 100644 --- a/src/cmd/extrinsics/instantiate.rs +++ b/src/cmd/extrinsics/instantiate.rs @@ -242,10 +242,10 @@ impl<'a> Exec<'a> { let code_stored = result .find_first::()? - .ok_or(anyhow!("Failed to find CodeStored event"))?; + .ok_or_else(|| anyhow!("Failed to find CodeStored event"))?; let instantiated = result .find_first::()? - .ok_or(anyhow!("Failed to find Instantiated event"))?; + .ok_or_else(|| anyhow!("Failed to find Instantiated event"))?; Ok((code_stored.code_hash, instantiated.contract)) } @@ -273,7 +273,7 @@ impl<'a> Exec<'a> { let instantiated = result .find_first::()? - .ok_or(anyhow!("Failed to find Instantiated event"))?; + .ok_or_else(|| anyhow!("Failed to find Instantiated event"))?; Ok(instantiated.contract) } diff --git a/src/cmd/extrinsics/transcode/encode.rs b/src/cmd/extrinsics/transcode/encode.rs index d64c1e91..3dab351f 100644 --- a/src/cmd/extrinsics/transcode/encode.rs +++ b/src/cmd/extrinsics/transcode/encode.rs @@ -178,10 +178,10 @@ impl<'a> Encoder<'a> { let variant_ident = match value { Value::Map(map) => map .ident() - .ok_or(anyhow::anyhow!("Missing enum variant identifier for map")), + .ok_or_else(|| anyhow::anyhow!("Missing enum variant identifier for map")), Value::Tuple(tuple) => tuple .ident() - .ok_or(anyhow::anyhow!("Missing enum variant identifier for tuple")), + .ok_or_else(|| anyhow::anyhow!("Missing enum variant identifier for tuple")), v => Err(anyhow::anyhow!("Invalid enum variant value '{:?}'", v)), }?; diff --git a/src/cmd/extrinsics/upload.rs b/src/cmd/extrinsics/upload.rs index 3d788ec4..5bef240c 100644 --- a/src/cmd/extrinsics/upload.rs +++ b/src/cmd/extrinsics/upload.rs @@ -129,7 +129,7 @@ impl UploadCommand { let code_stored = result .find_first::()? - .ok_or(anyhow::anyhow!("Failed to find CodeStored event"))?; + .ok_or_else(|| anyhow::anyhow!("Failed to find CodeStored event"))?; Ok(code_stored) } -- GitLab