mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-24 18:02:13 +00:00
Add clippy error checking in lint step
This commit is contained in:
parent
59dc6fd889
commit
5931944a21
@ -19,7 +19,7 @@ jobs:
|
||||
rustup component add rustfmt
|
||||
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
|
||||
displayName: Lint dependencies
|
||||
- script: cargo fmt --all -- --check
|
||||
- script: cargo fmt --all -- --check && cargo clippy --workspace
|
||||
displayName: Lint
|
||||
variables:
|
||||
rust_toolchain: '1.39.0'
|
||||
|
@ -1171,9 +1171,10 @@ pub fn tbaa_label<'ctx>(
|
||||
|
||||
// TODO: ContextRef can't return us the lifetime from module through Deref.
|
||||
// This could be fixed once generic_associated_types is stable.
|
||||
let context2 = &*context;
|
||||
let context = unsafe { std::mem::transmute::<&Context, &'ctx Context>(context2) };
|
||||
std::mem::forget(context2);
|
||||
let context = {
|
||||
let context2 = &*context;
|
||||
unsafe { std::mem::transmute::<&Context, &'ctx Context>(context2) }
|
||||
};
|
||||
|
||||
// `!wasmer_tbaa_root = {}`, the TBAA root node for wasmer.
|
||||
let tbaa_root = module
|
||||
|
@ -439,7 +439,7 @@ pub unsafe extern "C" fn wasmer_export_func_call(
|
||||
}
|
||||
|
||||
let params: Vec<Value> = {
|
||||
if params_len <= 0 {
|
||||
if params_len == 0 {
|
||||
vec![]
|
||||
} else {
|
||||
slice::from_raw_parts::<wasmer_value_t>(params, params_len as usize)
|
||||
|
@ -627,9 +627,11 @@ pub mod x64 {
|
||||
use crate::vm::Ctx;
|
||||
use std::any::Any;
|
||||
|
||||
#[allow(clippy::cast_ptr_alignment)]
|
||||
unsafe fn compute_vmctx_deref(vmctx: *const Ctx, seq: &[usize]) -> u64 {
|
||||
let mut ptr = &vmctx as *const *const Ctx as *const u8;
|
||||
for x in seq {
|
||||
debug_assert!(ptr.align_offset(std::mem::align_of::<*const u8>()) == 0);
|
||||
ptr = (*(ptr as *const *const u8)).offset(*x as isize);
|
||||
}
|
||||
ptr as usize as u64
|
||||
|
@ -570,6 +570,7 @@ pub struct FuncCtx {
|
||||
|
||||
impl FuncCtx {
|
||||
/// Offset to the `vmctx` field.
|
||||
#[allow(clippy::erasing_op)]
|
||||
pub const fn offset_vmctx() -> u8 {
|
||||
0 * (mem::size_of::<usize>() as u8)
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![allow(unused)]
|
||||
#![allow(unused, clippy::too_many_arguments)]
|
||||
pub mod types;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
pub mod unix;
|
||||
@ -331,7 +331,7 @@ pub fn fd_allocate(
|
||||
) -> __wasi_errno_t {
|
||||
debug!("wasi::fd_allocate");
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
let inode = fd_entry.inode;
|
||||
|
||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_ALLOCATE) {
|
||||
@ -374,7 +374,7 @@ pub fn fd_close(ctx: &mut Ctx, fd: __wasi_fd_t) -> __wasi_errno_t {
|
||||
debug!("=> fd={}", fd);
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
|
||||
wasi_try!(state.fs.close_fd(fd));
|
||||
|
||||
@ -389,7 +389,7 @@ pub fn fd_close(ctx: &mut Ctx, fd: __wasi_fd_t) -> __wasi_errno_t {
|
||||
pub fn fd_datasync(ctx: &mut Ctx, fd: __wasi_fd_t) -> __wasi_errno_t {
|
||||
debug!("wasi::fd_datasync");
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_DATASYNC) {
|
||||
return __WASI_EACCES;
|
||||
}
|
||||
@ -420,7 +420,7 @@ pub fn fd_fdstat_get(
|
||||
buf_ptr.offset()
|
||||
);
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
|
||||
let stat = wasi_try!(state.fs.fdstat(fd));
|
||||
let buf = wasi_try!(buf_ptr.deref(memory));
|
||||
@ -528,7 +528,7 @@ pub fn fd_filestat_set_size(
|
||||
) -> __wasi_errno_t {
|
||||
debug!("wasi::fd_filestat_set_size");
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
let inode = fd_entry.inode;
|
||||
|
||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_FILESTAT_SET_SIZE) {
|
||||
@ -1309,7 +1309,7 @@ pub fn path_create_directory(
|
||||
debug!("wasi::path_create_directory");
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
|
||||
let working_dir = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let working_dir = wasi_try!(state.fs.get_fd(fd));
|
||||
if let Kind::Root { .. } = &state.fs.inodes[working_dir.inode].kind {
|
||||
return __WASI_EACCES;
|
||||
}
|
||||
@ -1468,7 +1468,7 @@ pub fn path_filestat_set_times(
|
||||
) -> __wasi_errno_t {
|
||||
debug!("wasi::path_filestat_set_times");
|
||||
let (memory, state) = get_memory_and_wasi_state(ctx, 0);
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd)).clone();
|
||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||
let fd_inode = fd_entry.inode;
|
||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_PATH_FILESTAT_SET_TIMES) {
|
||||
return __WASI_EACCES;
|
||||
|
Loading…
x
Reference in New Issue
Block a user