Skip to content

Commit

Permalink
ci: cover all features with clippy (#1044)
Browse files Browse the repository at this point in the history
* ci: cover all features with clippy

Previously the abi generator code in bindgen wasn't covered.

* chore: fix clippy error

* ci: add single script to run all CI checks locally
  • Loading branch information
agostbiro authored Jul 3, 2023
1 parent b735b84 commit 159bd9b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- uses: Swatinem/rust-cache@v1
- name: Test Format
run: cargo fmt -- --check
- run: cargo clippy --features unstable,legacy --tests -- -Dclippy::all
- run: cargo clippy --tests --all-features -- -Dclippy::all
windows:
name: Windows
runs-on: windows-latest
Expand Down
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ Please use descriptive PR titles. We loosely follow the [conventional commits](h

Ensure the following are satisfied before opening a PR:
- Code is formatted with `rustfmt` by running `cargo fmt`
- Run `clippy`
- The exact command run by the CI is `cargo clippy --tests -- -Dclippy::all`
- Run tests with `cargo test`
- Test all examples with `./examples/test_all.sh`
- This must be done after the previous step
- Run all tests and linters with [./run-tests.sh](./run-tests.sh)
- Ensure any new functionality is adequately tested
- If any new public types or functions are added, ensure they have appropriate [rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) documentation
4 changes: 2 additions & 2 deletions near-sdk-macros/src/core_impl/abi/abi_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ impl ImplItemMethodInfo {
use MethodKind::*;

let some_abi_type = |result_serializer: &SerializerType| {
let abi_type = generate_abi_type(&return_value_type, result_serializer);
let abi_type = generate_abi_type(return_value_type, result_serializer);
quote! { Some(#abi_type) }
};

Expand Down Expand Up @@ -250,7 +250,7 @@ fn generate_schema(ty: &Type, serializer_type: &SerializerType) -> TokenStream2
}

fn generate_abi_type(ty: &Type, serializer_type: &SerializerType) -> TokenStream2 {
let schema = generate_schema(&ty, serializer_type);
let schema = generate_schema(ty, serializer_type);
match serializer_type {
SerializerType::JSON => quote! {
near_sdk::__private::AbiType::Json {
Expand Down
8 changes: 8 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

cargo fmt --check --all
cargo clippy --tests --all-features -- -Dclippy::all
cargo test --all --features unstable,legacy
./examples/test_all.sh

0 comments on commit 159bd9b

Please sign in to comment.