Skip to content

Commit

Permalink
Merge #1956
Browse files Browse the repository at this point in the history
1956: Enable clippy linting and fix issues r=MarkMcCaskey a=MarkMcCaskey

They weren't enabled before! now they are

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
bors[bot] and Mark McCaskey authored Dec 18, 2020
2 parents ada9a36 + f4bf679 commit cc74e60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
25 changes: 22 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,13 @@ test-packages:
cargo test -p wasmer-wasi --release
cargo test -p wasmer-object --release
cargo test -p wasmer-engine-native --release --no-default-features
cargo test -p wasmer-engine-jit --release --no-default-features
cargo test -p wasmer-compiler --release
cargo test -p wasmer-cli --release
cargo test -p wasmer-cache --release
cargo test -p wasmer-engine --release


# The test-capi rules depend on the build-capi rules to build the .a files to
# link the tests against. cargo test doesn't know that the tests will be running
test-capi: $(foreach compiler_engine,$(test_compilers_engines),test-capi-$(compiler_engine))
Expand Down Expand Up @@ -355,10 +358,26 @@ endif
update-testsuite:
git subtree pull --prefix tests/wast/spec https://github.com/WebAssembly/testsuite.git master --squash

RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects -D function_item_references" # TODO: add `-D missing-docs`
lint:
RUSTFLAGS := "-D dead-code -D nonstandard-style -D unused-imports -D unused-mut -D unused-variables -D unused-unsafe -D unreachable-patterns -D bad-style -D improper-ctypes -D unused-allocation -D unused-comparisons -D while-true -D unconditional-recursion -D bare-trait-objects" # TODO: add `-D missing-docs` # TODO: add `-D function_item_references` (not available on Rust 1.47, try when upgrading)
lint-packages:
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-vm
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-types
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-wasi
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-object
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine-native
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine-jit
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler-cranelift
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-compiler-singlepass
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-cli
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-cache
RUSTFLAGS=${RUSTFLAGS} cargo clippy -p wasmer-engine

lint-formatting:
cargo fmt --all -- --check
RUSTFLAGS=${RUSTFLAGS} cargo clippy $(compiler_features)

lint: lint-formatting lint-packages

install-local: package
tar -C ~/.wasmer -zxvf wasmer.tar.gz
Expand Down
9 changes: 4 additions & 5 deletions lib/compiler-cranelift/src/translator/code_translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
// destination block following the whole `if...end`. If we do end
// up discovering an `else`, then we will allocate a block for it
// and go back and patch the jump.
let destination = block_with_params(builder, results.clone(), environ)?;
let destination = block_with_params(builder, results, environ)?;
let branch_inst =
canonicalise_then_brz(builder, val, destination, state.peekn(params.len()));
(destination, ElseData::NoElse { branch_inst })
} else {
// The `if` type signature is not valid without an `else` block,
// so we eagerly allocate the `else` block here.
let destination = block_with_params(builder, results.clone(), environ)?;
let else_block = block_with_params(builder, params.clone(), environ)?;
let destination = block_with_params(builder, results, environ)?;
let else_block = block_with_params(builder, params, environ)?;
canonicalise_then_brz(builder, val, else_block, state.peekn(params.len()));
builder.seal_block(else_block);
(destination, ElseData::WithElse { else_block })
Expand Down Expand Up @@ -271,8 +271,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
let (params, _results) =
module_translation_state.blocktype_params_results(blocktype)?;
debug_assert_eq!(params.len(), num_return_values);
let else_block =
block_with_params(builder, params.clone(), environ)?;
let else_block = block_with_params(builder, params, environ)?;
canonicalise_then_jump(
builder,
destination,
Expand Down

0 comments on commit cc74e60

Please sign in to comment.