Repository: CosmWasm/cosmwasm (rust)

Issue:
Add second clippy job
As discussed in https://github.com/CosmWasm/cosmwasm/pull/1031, we should have two clippy jobs in the CI: one running the MSRV like all the other jobs and one running some resonably new version of Rust to check for more modern rules.

All builds should be reproducible, so some unstable nightly would be bad. A versioned beta release would be good. However, we don't get betas from https://hub.docker.com/_/rust. So we can simply use MSRV 1.51.0 and latest 1.54.0 for the two jobs. This should cover most problems.

Pull request description:
Run multiple clippy jobs in CI
Closes #1037

Patch:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index d4909b4e2..529f31431 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -1,6 +1,6 @@
-version: 2
+version: 2.1
+
 workflows:
-  version: 2
   test:
     # Keep those job names in sync with .mergify.yml
     jobs:
@@ -20,7 +20,11 @@ workflows:
       - contract_staking
       - fmt
       - fmt_extra
-      - clippy
+      - clippy:
+          matrix:
+            parameters:
+              # Run with MSRV and some modern stable Rust
+              rust-version: ["1.51.0", "1.54.0"]
       - benchmarking:
           requires:
             - package_vm
@@ -746,10 +750,13 @@ jobs:
           command: devtools/format_yml.sh -c
 
   clippy:
+    parameters:
+      rust-version:
+        type: string
     docker:
       # In this job we use the latest Rust stable in order to check against the
       # most recent code style recommendations.
-      - image: rust:1.51.0
+      - image: rust:<< parameters.rust-version >>
     steps:
       - checkout
       - run:
@@ -757,7 +764,7 @@ jobs:
           command: rustc --version && cargo --version
       - restore_cache:
           keys:
-            - cargocache-v2-clippy-rust:1.51.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
+            - cargocache-v2-clippy-rust:<< parameters.rust-version >>-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
       - run:
           name: Add clippy component
           command: rustup component add clippy
@@ -892,7 +899,7 @@ jobs:
             - contracts/staking/target/debug/.fingerprint
             - contracts/staking/target/debug/build
             - contracts/staking/target/debug/deps
-          key: cargocache-v2-clippy-rust:1.51.0-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
+          key: cargocache-v2-clippy-rust:<< parameters.rust-version >>-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/burner/Cargo.lock" }}-{{ checksum "contracts/crypto-verify/Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect/Cargo.lock" }}-{{ checksum "contracts/ibc-reflect-send/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
 
   benchmarking:
     docker:
diff --git a/contracts/ibc-reflect/src/contract.rs b/contracts/ibc-reflect/src/contract.rs
index c2ff44a18..9de3d45d3 100644
--- a/contracts/ibc-reflect/src/contract.rs
+++ b/contracts/ibc-reflect/src/contract.rs
@@ -160,12 +160,12 @@ pub fn ibc_channel_connect(
         code_id: cfg.reflect_code_id,
         msg: b"{}".into(),
         funds: vec![],
-        label: format!("ibc-reflect-{}", &chan_id),
+        label: format!("ibc-reflect-{}", chan_id),
     };
     let msg = SubMsg::reply_on_success(msg, INIT_CALLBACK_ID);
 
     // store the channel id for the reply handler
-    pending_channel(deps.storage).save(&chan_id)?;
+    pending_channel(deps.storage).save(chan_id)?;
 
     Ok(IbcBasicResponse::new()
         .add_submessage(msg)
@@ -463,7 +463,7 @@ mod tests {
         let response = Reply {
             id,
             result: ContractResult::Ok(SubMsgExecutionResponse {
-                events: fake_events(&REFLECT_ADDR),
+                events: fake_events(REFLECT_ADDR),
                 data: None,
             }),
         };
@@ -551,7 +551,7 @@ mod tests {
             assert_eq!(account, contract_addr.as_str());
             assert_eq!(0, funds.len());
             // parse the message - should callback with proper channel_id
-            let rmsg: ReflectExecuteMsg = from_slice(&msg).unwrap();
+            let rmsg: ReflectExecuteMsg = from_slice(msg).unwrap();
             assert_eq!(
                 rmsg,
                 ReflectExecuteMsg::ReflectMsg {
diff --git a/packages/crypto/src/ed25519.rs b/packages/crypto/src/ed25519.rs
index 3ada6918e..ad642c307 100644
--- a/packages/crypto/src/ed25519.rs
+++ b/packages/crypto/src/ed25519.rs
@@ -25,7 +25,7 @@ pub fn ed25519_verify(message: &[u8], signature: &[u8], public_key: &[u8]) -> Cr
 
     // Verification
     match VerificationKey::try_from(pubkey)
-        .and_then(|vk| vk.verify(&Signature::from(signature), &message))
+        .and_then(|vk| vk.verify(&Signature::from(signature), message))
     {
         Ok(()) => Ok(true),
         Err(_) => Ok(false),
@@ -184,7 +184,7 @@ mod tests {
         let message = MSG.as_bytes();
         // Signing
         let secret_key = SigningKey::new(&mut OsRng);
-        let signature = secret_key.sign(&message);
+        let signature = secret_key.sign(message);
 
         let public_key = VerificationKey::from(&secret_key);
 
@@ -193,7 +193,7 @@ mod tests {
         let public_key_bytes: [u8; 32] = public_key.into();
 
         // Verification
-        assert!(ed25519_verify(&message, &signature_bytes, &public_key_bytes).unwrap());
+        assert!(ed25519_verify(message, &signature_bytes, &public_key_bytes).unwrap());
 
         // Wrong message fails
         let bad_message = [message, b"\0"].concat();
@@ -203,7 +203,7 @@ mod tests {
         let other_secret_key = SigningKey::new(&mut OsRng);
         let other_public_key = VerificationKey::from(&other_secret_key);
         let other_public_key_bytes: [u8; 32] = other_public_key.into();
-        assert!(!ed25519_verify(&message, &signature_bytes, &other_public_key_bytes).unwrap());
+        assert!(!ed25519_verify(message, &signature_bytes, &other_public_key_bytes).unwrap());
     }
 
     #[test]
@@ -220,7 +220,7 @@ mod tests {
                 .as_slice(),
         )
         .unwrap();
-        let signature = secret_key.sign(&COSMOS_ED25519_MSG.as_bytes());
+        let signature = secret_key.sign(COSMOS_ED25519_MSG.as_bytes());
 
         let signature_bytes: [u8; 64] = signature.into();
         let public_key_bytes: [u8; 32] = public_key.into();
@@ -233,7 +233,7 @@ mod tests {
         );
 
         assert!(ed25519_verify(
-            &COSMOS_ED25519_MSG.as_bytes(),
+            COSMOS_ED25519_MSG.as_bytes(),
             &signature_bytes,
             &public_key_bytes
         )
diff --git a/packages/schema/src/export.rs b/packages/schema/src/export.rs
index e11ea66ce..2e5c7dcd1 100644
--- a/packages/schema/src/export.rs
+++ b/packages/schema/src/export.rs
@@ -26,14 +26,14 @@ pub fn export_schema_with_title(schema: &RootSchema, out_dir: &Path, title: &str
     if let Some(metadata) = &mut schema.schema.metadata {
         metadata.title = Some(title.to_string());
     }
-    write_schema(&schema, out_dir, &title);
+    write_schema(&schema, out_dir, title);
 }
 
 /// Writes schema to file. Overwrites existing file.
 /// Panics on any error writing out the schema.
 fn write_schema(schema: &RootSchema, out_dir: &Path, title: &str) {
     // first, we set the title as we wish
-    let path = out_dir.join(format!("{}.json", to_snake_case(&title)));
+    let path = out_dir.join(format!("{}.json", to_snake_case(title)));
     let json = serde_json::to_string_pretty(schema).unwrap();
     write(&path, json + "\n").unwrap();
     println!("Created {}", path.to_str().unwrap());
diff --git a/packages/std/src/addresses.rs b/packages/std/src/addresses.rs
index f922c29df..16f5f36ed 100644
--- a/packages/std/src/addresses.rs
+++ b/packages/std/src/addresses.rs
@@ -278,7 +278,7 @@ impl Deref for CanonicalAddr {
 
 impl CanonicalAddr {
     pub fn as_slice(&self) -> &[u8] {
-        &self.0.as_slice()
+        self.0.as_slice()
     }
 }
 
diff --git a/packages/std/src/errors/system_error.rs b/packages/std/src/errors/system_error.rs
index e04a6bbcd..e6480ae0c 100644
--- a/packages/std/src/errors/system_error.rs
+++ b/packages/std/src/errors/system_error.rs
@@ -43,13 +43,13 @@ impl std::fmt::Display for SystemError {
                 f,
                 "Cannot parse request: {} in: {}",
                 error,
-                String::from_utf8_lossy(&request)
+                String::from_utf8_lossy(request)
             ),
             SystemError::InvalidResponse { error, response } => write!(
                 f,
                 "Cannot parse response: {} in: {}",
                 error,
-                String::from_utf8_lossy(&response)
+                String::from_utf8_lossy(response)
             ),
             SystemError::NoSuchContract { addr } => write!(f, "No such contract: {}", addr),
             SystemError::Unknown {} => write!(f, "Unknown system error"),
diff --git a/packages/std/src/mock.rs b/packages/std/src/mock.rs
index 70eb6f688..a43e1957e 100644
--- a/packages/std/src/mock.rs
+++ b/packages/std/src/mock.rs
@@ -747,7 +747,7 @@ mod tests {
         api.addr_canonicalize(&input).unwrap();
 
         let input = "foobar456";
-        api.addr_canonicalize(&input).unwrap();
+        api.addr_canonicalize(input).unwrap();
     }
 
     #[test]
@@ -955,8 +955,8 @@ mod tests {
         let signature = hex::decode(ED25519_SIG_HEX).unwrap();
         let public_key: Vec<u8> = vec![0u8; 0];
 
-        let msgs: Vec<&[u8]> = vec![&msg.as_slice()];
-        let signatures: Vec<&[u8]> = vec![&signature.as_slice()];
+        let msgs: Vec<&[u8]> = vec![msg.as_slice()];
+        let signatures: Vec<&[u8]> = vec![signature.as_slice()];
         let public_keys: Vec<&[u8]> = vec![&public_key];
 
         let res = api.ed25519_batch_verify(&msgs, &signatures, &public_keys);
diff --git a/packages/storage/src/sequence.rs b/packages/storage/src/sequence.rs
index 6d81de2b7..30f9491cb 100644
--- a/packages/storage/src/sequence.rs
+++ b/packages/storage/src/sequence.rs
@@ -16,7 +16,7 @@ pub fn currval(seq: &Singleton<u64>) -> StdResult<u64> {
 /// nextval increments the counter by 1 and returns the new value.
 /// On the first time it is called (no sequence info in db) it will return 1.
 pub fn nextval(seq: &mut Singleton<u64>) -> StdResult<u64> {
-    let val = currval(&seq)? + 1;
+    let val = currval(seq)? + 1;
     seq.save(&val)?;
     Ok(val)
 }
diff --git a/packages/storage/src/type_helpers.rs b/packages/storage/src/type_helpers.rs
index 2bcdb0b1d..a32bc3776 100644
--- a/packages/storage/src/type_helpers.rs
+++ b/packages/storage/src/type_helpers.rs
@@ -13,7 +13,7 @@ pub(crate) fn may_deserialize<T: DeserializeOwned>(
     value: &Option<Vec<u8>>,
 ) -> StdResult<Option<T>> {
     match value {
-        Some(vec) => Ok(Some(from_slice(&vec)?)),
+        Some(data) => Ok(Some(from_slice(data)?)),
         None => Ok(None),
     }
 }
@@ -21,7 +21,7 @@ pub(crate) fn may_deserialize<T: DeserializeOwned>(
 /// must_deserialize parses json bytes from storage (Option), returning NotFound error if no data present
 pub(crate) fn must_deserialize<T: DeserializeOwned>(value: &Option<Vec<u8>>) -> StdResult<T> {
     match value {
-        Some(vec) => from_slice(&vec),
+        Some(data) => from_slice(data),
         None => Err(StdError::not_found(type_name::<T>())),
     }
 }
diff --git a/packages/vm/examples/module_size.rs b/packages/vm/examples/module_size.rs
index cdc83d116..1cbbe0c6c 100644
--- a/packages/vm/examples/module_size.rs
+++ b/packages/vm/examples/module_size.rs
@@ -69,7 +69,7 @@ pub fn main() {
 
 #[inline(never)]
 fn module_compile(wasm: &[u8], memory_limit: Option<Size>) -> Module {
-    compile(&wasm, memory_limit).unwrap()
+    compile(wasm, memory_limit).unwrap()
 }
 
 #[inline(never)]
diff --git a/packages/vm/src/calls.rs b/packages/vm/src/calls.rs
index f341ea906..e27f5abb6 100644
--- a/packages/vm/src/calls.rs
+++ b/packages/vm/src/calls.rs
@@ -599,7 +599,7 @@ mod tests {
 
     #[test]
     fn call_instantiate_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -611,7 +611,7 @@ mod tests {
 
     #[test]
     fn call_execute_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -630,7 +630,7 @@ mod tests {
 
     #[test]
     fn call_migrate_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -655,7 +655,7 @@ mod tests {
 
     #[test]
     fn call_query_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -739,12 +739,12 @@ mod tests {
         const ACCOUNT: &str = "account-456";
         #[test]
         fn call_ibc_channel_open_and_connect_works() {
-            let mut instance = mock_instance(&CONTRACT, &[]);
+            let mut instance = mock_instance(CONTRACT, &[]);
             setup(&mut instance, CHANNEL_ID, ACCOUNT);
         }
         #[test]
         fn call_ibc_channel_close_works() {
-            let mut instance = mock_instance(&CONTRACT, &[]);
+            let mut instance = mock_instance(CONTRACT, &[]);
             setup(&mut instance, CHANNEL_ID, ACCOUNT);
             let handshake_close =
                 mock_ibc_channel_close_init(CHANNEL_ID, IbcOrder::Ordered, IBC_VERSION);
@@ -754,7 +754,7 @@ mod tests {
         }
         #[test]
         fn call_ibc_packet_ack_works() {
-            let mut instance = mock_instance(&CONTRACT, &[]);
+            let mut instance = mock_instance(CONTRACT, &[]);
             setup(&mut instance, CHANNEL_ID, ACCOUNT);
             let ack = IbcAcknowledgement::new(br#"{}"#);
             let msg = mock_ibc_packet_ack(CHANNEL_ID, br#"{}"#, ack).unwrap();
@@ -764,7 +764,7 @@ mod tests {
         }
         #[test]
         fn call_ibc_packet_timeout_works() {
-            let mut instance = mock_instance(&CONTRACT, &[]);
+            let mut instance = mock_instance(CONTRACT, &[]);
             setup(&mut instance, CHANNEL_ID, ACCOUNT);
             let msg = mock_ibc_packet_timeout(CHANNEL_ID, br#"{}"#).unwrap();
             call_ibc_packet_timeout::<_, _, _, Empty>(&mut instance, &mock_env(), &msg)
@@ -773,7 +773,7 @@ mod tests {
         }
         #[test]
         fn call_ibc_packet_receive_works() {
-            let mut instance = mock_instance(&CONTRACT, &[]);
+            let mut instance = mock_instance(CONTRACT, &[]);
             setup(&mut instance, CHANNEL_ID, ACCOUNT);
             let who_am_i = br#"{"who_am_i":{}}"#;
             let msg = mock_ibc_packet_recv(CHANNEL_ID, who_am_i).unwrap();
diff --git a/packages/vm/src/compatibility.rs b/packages/vm/src/compatibility.rs
index c2ca76ae2..e0c485cf5 100644
--- a/packages/vm/src/compatibility.rs
+++ b/packages/vm/src/compatibility.rs
@@ -180,7 +180,7 @@ fn check_wasm_features(module: &Module, supported_features: &HashSet<String>) ->
     let required_features = required_features_from_module(module);
     if !required_features.is_subset(supported_features) {
         // We switch to BTreeSet to get a sorted error message
-        let unsupported: BTreeSet<_> = required_features.difference(&supported_features).collect();
+        let unsupported: BTreeSet<_> = required_features.difference(supported_features).collect();
         return Err(VmError::static_validation_err(format!(
             "Wasm contract requires unsupported features: {}",
             unsupported.to_string_limited(200)
diff --git a/packages/vm/src/environment.rs b/packages/vm/src/environment.rs
index b6882f2c5..179f6c1e2 100644
--- a/packages/vm/src/environment.rs
+++ b/packages/vm/src/environment.rs
@@ -418,25 +418,25 @@ mod tests {
     ) {
         let env = Environment::new(MockApi::default(), gas_limit, false);
 
-        let module = compile(&CONTRACT, TESTING_MEMORY_LIMIT).unwrap();
+        let module = compile(CONTRACT, TESTING_MEMORY_LIMIT).unwrap();
         let store = module.store();
         // we need stubs for all required imports
         let import_obj = imports! {
             "env" => {
-                "db_read" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "db_write" => Function::new_native(&store, |_a: u32, _b: u32| {}),
-                "db_remove" => Function::new_native(&store, |_a: u32| {}),
-                "db_scan" => Function::new_native(&store, |_a: u32, _b: u32, _c: i32| -> u32 { 0 }),
-                "db_next" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "query_chain" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "addr_validate" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "addr_canonicalize" => Function::new_native(&store, |_a: u32, _b: u32| -> u32 { 0 }),
-                "addr_humanize" => Function::new_native(&store, |_a: u32, _b: u32| -> u32 { 0 }),
-                "secp256k1_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "secp256k1_recover_pubkey" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u64 { 0 }),
-                "ed25519_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "ed25519_batch_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "debug" => Function::new_native(&store, |_a: u32| {}),
+                "db_read" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "db_write" => Function::new_native(store, |_a: u32, _b: u32| {}),
+                "db_remove" => Function::new_native(store, |_a: u32| {}),
+                "db_scan" => Function::new_native(store, |_a: u32, _b: u32, _c: i32| -> u32 { 0 }),
+                "db_next" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "query_chain" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "addr_validate" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "addr_canonicalize" => Function::new_native(store, |_a: u32, _b: u32| -> u32 { 0 }),
+                "addr_humanize" => Function::new_native(store, |_a: u32, _b: u32| -> u32 { 0 }),
+                "secp256k1_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "secp256k1_recover_pubkey" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u64 { 0 }),
+                "ed25519_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "ed25519_batch_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "debug" => Function::new_native(store, |_a: u32| {}),
             },
         };
         let instance = Box::from(WasmerInstance::new(&module, &import_obj).unwrap());
diff --git a/packages/vm/src/imports.rs b/packages/vm/src/imports.rs
index 70a97b381..b1a4c9890 100644
--- a/packages/vm/src/imports.rs
+++ b/packages/vm/src/imports.rs
@@ -479,25 +479,25 @@ mod tests {
         let gas_limit = TESTING_GAS_LIMIT;
         let env = Environment::new(api, gas_limit, false);
 
-        let module = compile(&CONTRACT, TESTING_MEMORY_LIMIT).unwrap();
+        let module = compile(CONTRACT, TESTING_MEMORY_LIMIT).unwrap();
         let store = module.store();
         // we need stubs for all required imports
         let import_obj = imports! {
             "env" => {
-                "db_read" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "db_write" => Function::new_native(&store, |_a: u32, _b: u32| {}),
-                "db_remove" => Function::new_native(&store, |_a: u32| {}),
-                "db_scan" => Function::new_native(&store, |_a: u32, _b: u32, _c: i32| -> u32 { 0 }),
-                "db_next" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "query_chain" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "addr_validate" => Function::new_native(&store, |_a: u32| -> u32 { 0 }),
-                "addr_canonicalize" => Function::new_native(&store, |_a: u32, _b: u32| -> u32 { 0 }),
-                "addr_humanize" => Function::new_native(&store, |_a: u32, _b: u32| -> u32 { 0 }),
-                "secp256k1_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "secp256k1_recover_pubkey" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u64 { 0 }),
-                "ed25519_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "ed25519_batch_verify" => Function::new_native(&store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
-                "debug" => Function::new_native(&store, |_a: u32| {}),
+                "db_read" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "db_write" => Function::new_native(store, |_a: u32, _b: u32| {}),
+                "db_remove" => Function::new_native(store, |_a: u32| {}),
+                "db_scan" => Function::new_native(store, |_a: u32, _b: u32, _c: i32| -> u32 { 0 }),
+                "db_next" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "query_chain" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "addr_validate" => Function::new_native(store, |_a: u32| -> u32 { 0 }),
+                "addr_canonicalize" => Function::new_native(store, |_a: u32, _b: u32| -> u32 { 0 }),
+                "addr_humanize" => Function::new_native(store, |_a: u32, _b: u32| -> u32 { 0 }),
+                "secp256k1_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "secp256k1_recover_pubkey" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u64 { 0 }),
+                "ed25519_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "ed25519_batch_verify" => Function::new_native(store, |_a: u32, _b: u32, _c: u32| -> u32 { 0 }),
+                "debug" => Function::new_native(store, |_a: u32| {}),
             },
         };
         let instance = Box::from(WasmerInstance::new(&module, &import_obj).unwrap());
diff --git a/packages/vm/src/instance.rs b/packages/vm/src/instance.rs
index 39a89ca1d..6a29f11d8 100644
--- a/packages/vm/src/instance.rs
+++ b/packages/vm/src/instance.rs
@@ -393,7 +393,7 @@ mod tests {
 
     #[test]
     fn call_function0_works() {
-        let instance = mock_instance(&CONTRACT, &[]);
+        let instance = mock_instance(CONTRACT, &[]);
 
         instance
             .call_function0("interface_version_7", &[])
@@ -402,7 +402,7 @@ mod tests {
 
     #[test]
     fn call_function1_works() {
-        let instance = mock_instance(&CONTRACT, &[]);
+        let instance = mock_instance(CONTRACT, &[]);
 
         // can call function few times
         let result = instance
@@ -424,7 +424,7 @@ mod tests {
     #[test]
     fn allocate_deallocate_works() {
         let mut instance = mock_instance_with_options(
-            &CONTRACT,
+            CONTRACT,
             MockInstanceOptions {
                 memory_limit: Some(Size::mebi(500)),
                 ..Default::default()
@@ -451,7 +451,7 @@ mod tests {
 
     #[test]
     fn write_and_read_memory_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         let sizes: Vec<usize> = vec![
             0,
@@ -484,7 +484,7 @@ mod tests {
     fn errors_in_imports() {
         // set up an instance that will experience an error in an import
         let error_message = "Api failed intentionally";
-        let mut instance = mock_instance_with_failing_api(&CONTRACT, &[], error_message);
+        let mut instance = mock_instance_with_failing_api(CONTRACT, &[], error_message);
         let init_result = call_instantiate::<_, _, _, serde_json::Value>(
             &mut instance,
             &mock_env(),
@@ -502,7 +502,7 @@ mod tests {
     fn read_memory_errors_when_when_length_is_too_long() {
         let length = 6;
         let max_length = 5;
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // Allocate sets length to 0. Write some data to increase length.
         let region_ptr = instance.allocate(length).expect("error allocating");
@@ -570,7 +570,7 @@ mod tests {
 
     #[test]
     fn memory_pages_grows_with_usage() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         assert_eq!(instance.memory_pages(), 17);
 
@@ -586,7 +586,7 @@ mod tests {
 
     #[test]
     fn get_gas_left_works() {
-        let instance = mock_instance_with_gas_limit(&CONTRACT, 123321);
+        let instance = mock_instance_with_gas_limit(CONTRACT, 123321);
         let orig_gas = instance.get_gas_left();
         assert_eq!(orig_gas, 123321);
     }
@@ -594,7 +594,7 @@ mod tests {
     #[test]
     fn create_gas_report_works() {
         const LIMIT: u64 = 7_000_000;
-        let mut instance = mock_instance_with_gas_limit(&CONTRACT, LIMIT);
+        let mut instance = mock_instance_with_gas_limit(CONTRACT, LIMIT);
 
         let report1 = instance.create_gas_report();
         assert_eq!(report1.used_externally, 0);
@@ -621,7 +621,7 @@ mod tests {
 
     #[test]
     fn set_storage_readonly_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         assert!(instance.env.is_storage_readonly());
 
@@ -637,7 +637,7 @@ mod tests {
 
     #[test]
     fn with_storage_works() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // initial check
         instance
@@ -668,7 +668,7 @@ mod tests {
     #[should_panic]
     fn with_storage_safe_for_panic() {
         // this should fail with the assertion, but not cause a double-free crash (issue #59)
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
         instance
             .with_storage::<_, ()>(|_store| panic!("trigger failure"))
             .unwrap();
@@ -678,7 +678,7 @@ mod tests {
     fn with_querier_works_readonly() {
         let rich_addr = String::from("foobar");
         let rich_balance = vec![coin(10000, "gold"), coin(8000, "silver")];
-        let mut instance = mock_instance_with_balances(&CONTRACT, &[(&rich_addr, &rich_balance)]);
+        let mut instance = mock_instance_with_balances(CONTRACT, &[(&rich_addr, &rich_balance)]);
 
         // query one
         instance
@@ -734,7 +734,7 @@ mod tests {
         let rich_addr = String::from("foobar");
         let rich_balance1 = vec![coin(10000, "gold"), coin(500, "silver")];
         let rich_balance2 = vec![coin(10000, "gold"), coin(8000, "silver")];
-        let mut instance = mock_instance_with_balances(&CONTRACT, &[(&rich_addr, &rich_balance1)]);
+        let mut instance = mock_instance_with_balances(CONTRACT, &[(&rich_addr, &rich_balance1)]);
 
         // Get initial state
         instance
@@ -799,7 +799,7 @@ mod singlepass_tests {
 
     #[test]
     fn contract_deducts_gas_init() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
         let orig_gas = instance.get_gas_left();
 
         // init contract
@@ -815,7 +815,7 @@ mod singlepass_tests {
 
     #[test]
     fn contract_deducts_gas_execute() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init contract
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -838,7 +838,7 @@ mod singlepass_tests {
 
     #[test]
     fn contract_enforces_gas_limit() {
-        let mut instance = mock_instance_with_gas_limit(&CONTRACT, 20_000);
+        let mut instance = mock_instance_with_gas_limit(CONTRACT, 20_000);
 
         // init contract
         let info = mock_info("creator", &coins(1000, "earth"));
@@ -849,7 +849,7 @@ mod singlepass_tests {
 
     #[test]
     fn query_works_with_gas_metering() {
-        let mut instance = mock_instance(&CONTRACT, &[]);
+        let mut instance = mock_instance(CONTRACT, &[]);
 
         // init contract
         let info = mock_info("creator", &coins(1000, "earth"));
diff --git a/packages/vm/src/static_analysis.rs b/packages/vm/src/static_analysis.rs
index 748d6cbd1..4be596ff8 100644
--- a/packages/vm/src/static_analysis.rs
+++ b/packages/vm/src/static_analysis.rs
@@ -13,7 +13,7 @@ pub const REQUIRED_IBC_EXPORTS: &[&str] = &[
 ];
 
 pub fn deserialize_wasm(wasm_code: &[u8]) -> VmResult<Module> {
-    deserialize_buffer(&wasm_code).map_err(|err| {
+    deserialize_buffer(wasm_code).map_err(|err| {
         VmError::static_validation_err(format!(
             "Wasm bytecode could not be deserialized. Deserialization error: \"{}\"",
             err


Test patch:
diff --git a/contracts/ibc-reflect/tests/integration.rs b/contracts/ibc-reflect/tests/integration.rs
index 3c16cf83f..62a86eb2b 100644
--- a/contracts/ibc-reflect/tests/integration.rs
+++ b/contracts/ibc-reflect/tests/integration.rs
@@ -172,7 +172,7 @@ fn proper_handshake_flow() {
     let response = Reply {
         id,
         result: ContractResult::Ok(SubMsgExecutionResponse {
-            events: fake_events(&REFLECT_ADDR),
+            events: fake_events(REFLECT_ADDR),
             data: None,
         }),
     };
@@ -263,7 +263,7 @@ fn handle_dispatch_packet() {
         assert_eq!(account, contract_addr.as_str());
         assert_eq!(0, funds.len());
         // parse the message - should callback with proper channel_id
-        let rmsg: ReflectExecuteMsg = from_slice(&msg, DESERIALIZATION_LIMIT).unwrap();
+        let rmsg: ReflectExecuteMsg = from_slice(msg, DESERIALIZATION_LIMIT).unwrap();
         assert_eq!(
             rmsg,
             ReflectExecuteMsg::ReflectMsg {
diff --git a/contracts/reflect/src/testing.rs b/contracts/reflect/src/testing.rs
index 32ccedaaf..8237329b1 100644
--- a/contracts/reflect/src/testing.rs
+++ b/contracts/reflect/src/testing.rs
@@ -10,7 +10,7 @@ pub fn mock_dependencies_with_custom_querier(
 ) -> OwnedDeps<MockStorage, MockApi, MockQuerier<SpecialQuery>> {
     let custom_querier: MockQuerier<SpecialQuery> =
         MockQuerier::new(&[(MOCK_CONTRACT_ADDR, contract_balance)])
-            .with_custom_handler(|query| SystemResult::Ok(custom_query_execute(&query)));
+            .with_custom_handler(|query| SystemResult::Ok(custom_query_execute(query)));
     OwnedDeps {
         storage: MockStorage::default(),
         api: MockApi::default(),