Skip to content

Commit

Permalink
chore(*) add linting to ngx-wasm-rs crate & fix warnings
Browse files Browse the repository at this point in the history
Fix #268
  • Loading branch information
thibaultcha committed Dec 11, 2023
1 parent 88ec9b9 commit 5eaa898
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ jobs:
- run: make lint
- name: 'Rust lint'
if: ${{ !env.ACT }}
run: cargo clippy --all-features
run: |
cargo clippy --all-features
cd lib/ngx-wasm-rs && cargo clippy --all-features
- run: |
if [[ $(make reindex 2>&1 | tee reindex.out | grep -c done) -gt 0 ]]; then
cat reindex.out >&2
Expand Down
8 changes: 5 additions & 3 deletions lib/ngx-wasm-rs/lib/wat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use ngx_wasm_c_api::*;
use regex::Regex;
use std::mem;
use unescape::unescape;
use wabt;

#[macro_use]
extern crate lazy_static;
Expand All @@ -23,7 +22,7 @@ fn extract_message(err: &str) -> Option<String> {
}
}

fn vec_into_wasm_byte_vec_t(bv: *mut wasm_byte_vec_t, v: Vec<u8>) -> () {
fn vec_into_wasm_byte_vec_t(bv: *mut wasm_byte_vec_t, v: Vec<u8>) {
unsafe {
// FIXME Update this when vec_into_raw_parts is stabilized
let mut v = mem::ManuallyDrop::new(v);
Expand All @@ -32,8 +31,11 @@ fn vec_into_wasm_byte_vec_t(bv: *mut wasm_byte_vec_t, v: Vec<u8>) -> () {
}
}

/// # Safety
///
/// This function should be called with a valid wat wasm_byte_vec_t pointer.
#[no_mangle]
pub extern "C" fn ngx_wasm_wat_to_wasm(
pub unsafe extern "C" fn ngx_wasm_wat_to_wasm(
wat: *const wasm_byte_vec_t,
wasm: *mut wasm_byte_vec_t,
) -> Option<Box<wasm_byte_vec_t>> {
Expand Down

0 comments on commit 5eaa898

Please sign in to comment.