From 8ce8457b606ea081918d3c88934d851ab8876465 Mon Sep 17 00:00:00 2001 From: Sturdy Date: Mon, 13 Feb 2023 15:01:28 +0100 Subject: [PATCH 1/4] ci: Make Clippy only check on CI --- .github/workflows/lint-format.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 93f225d..909bcf3 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -32,14 +32,7 @@ jobs: with: toolchain: nightly command: clippy - args: --fix -- -D warnings - - - name: Print fmt version - uses: actions-rs/cargo@v1 - with: - toolchain: nightly - command: fmt - args: --version + args: -- -D warnings - name: Run cargo fmt uses: actions-rs/cargo@v1 From 960176726691d1ebf2f68efbca63d00b4c4983a7 Mon Sep 17 00:00:00 2001 From: Sturdy Date: Mon, 13 Feb 2023 15:25:47 +0100 Subject: [PATCH 2/4] chore: clippy fix nightly --- .github/workflows/lint-format.yml | 2 +- src/asset.rs | 6 +++--- src/asset_info.rs | 10 +++++----- src/asset_list.rs | 6 +----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index 909bcf3..a8587ab 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -32,7 +32,7 @@ jobs: with: toolchain: nightly command: clippy - args: -- -D warnings + args: --all-features -D warnings - name: Run cargo fmt uses: actions-rs/cargo@v1 diff --git a/src/asset.rs b/src/asset.rs index 98b6408..a3ef072 100644 --- a/src/asset.rs +++ b/src/asset.rs @@ -384,9 +384,9 @@ mod tests { let uusd = Asset::native("uusd", 69u128); let astro = Asset::cw20(Addr::unchecked("astro_token"), 69u128); - assert_eq!(uluna1 == uluna2, false); - assert_eq!(uluna1 == uusd, false); - assert_eq!(astro == astro.clone(), true); + assert!(uluna1 != uluna2); + assert!(uluna1 != uusd); + assert!(astro == astro.clone()); } #[test] diff --git a/src/asset_info.rs b/src/asset_info.rs index eaa42ac..2ca9d51 100644 --- a/src/asset_info.rs +++ b/src/asset_info.rs @@ -265,11 +265,11 @@ mod test { let astro = AssetInfo::cw20(Addr::unchecked("astro_token")); let mars = AssetInfo::cw20(Addr::unchecked("mars_token")); - assert_eq!(uluna == uusd, false); - assert_eq!(uluna == astro, false); - assert_eq!(astro == mars, false); - assert_eq!(uluna == uluna.clone(), true); - assert_eq!(astro == astro.clone(), true); + assert!(uluna != uusd); + assert!(uluna != astro); + assert!(astro != mars); + assert!(uluna == uluna.clone()); + assert!(astro == astro.clone()); } #[test] diff --git a/src/asset_list.rs b/src/asset_list.rs index 8becc8f..6c344d7 100644 --- a/src/asset_list.rs +++ b/src/asset_list.rs @@ -269,11 +269,7 @@ impl AssetList { /// Query balances for all assets in the list for the given address and /// return a new `AssetList` - pub fn query_balances + Clone>( - &self, - querier: &QuerierWrapper, - addr: &Addr, - ) -> StdResult { + pub fn query_balances(&self, querier: &QuerierWrapper, addr: &Addr) -> StdResult { self.into_iter() .map(|asset| { Ok(Asset::new( From 2c48d71334cb56b997844547c408670be7eda97f Mon Sep 17 00:00:00 2001 From: Sturdy Date: Mon, 13 Feb 2023 15:31:17 +0100 Subject: [PATCH 3/4] build: run clippy nightly on cargo make --- Makefile.toml | 2 ++ deny.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.toml b/Makefile.toml index f8a4968..0704fc3 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -27,9 +27,11 @@ command = "cargo" args = ["check"] [tasks.clippy-check] +toolchain = "nightly" command = "cargo" args = ["clippy","--all-features","--","-D","warnings"] [tasks.clippy-fix] +toolchain = "nightly" command = "cargo" args = ["clippy","--fix","--allow-staged","--","-D","warnings"] diff --git a/deny.toml b/deny.toml index e6a50f9..bbc9c7e 100644 --- a/deny.toml +++ b/deny.toml @@ -19,7 +19,7 @@ ignore = [ ] [bans] -multiple-versions = "allow" # TODO:update this +multiple-versions = "allow" deny = [] skip = [] From d543bb7e04f9f44a6ca1b23c99a7f365b997d5e2 Mon Sep 17 00:00:00 2001 From: Sturdy Date: Mon, 13 Feb 2023 15:38:28 +0100 Subject: [PATCH 4/4] ci: fix clippy --- .github/workflows/lint-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index a8587ab..4d1e9b3 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -32,7 +32,7 @@ jobs: with: toolchain: nightly command: clippy - args: --all-features -D warnings + args: --all-features -- -D warnings - name: Run cargo fmt uses: actions-rs/cargo@v1