Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteNacked committed Nov 21, 2024
1 parent 20e03ac commit 6cb7ff0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lazy-pages/src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct GlobalsAccessWasmRuntime<'a> {
pub instance: &'a mut SandboxInstance,
}

impl<'a> GlobalsAccessor for GlobalsAccessWasmRuntime<'a> {
impl GlobalsAccessor for GlobalsAccessWasmRuntime<'_> {
fn get_i64(&mut self, name: &LimitedStr) -> Result<i64, GlobalsAccessError> {
// SAFETY: this is safe because this method is called only from signal handler context
unsafe {
Expand Down Expand Up @@ -80,7 +80,7 @@ struct GlobalsAccessNativeRuntime<'a, 'b> {
pub inner_access_provider: &'a mut &'b mut dyn GlobalsAccessor,
}

impl<'a, 'b> GlobalsAccessor for GlobalsAccessNativeRuntime<'a, 'b> {
impl GlobalsAccessor for GlobalsAccessNativeRuntime<'_, '_> {
fn get_i64(&mut self, name: &LimitedStr) -> Result<i64, GlobalsAccessError> {
self.inner_access_provider.get_i64(name)
}
Expand Down
4 changes: 2 additions & 2 deletions lazy-pages/src/host_func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub(crate) struct HostFuncAccessHandler<'a> {
pub gas_charger: GasCharger,
}

impl<'a> AccessHandler for HostFuncAccessHandler<'a> {
impl AccessHandler for HostFuncAccessHandler<'_> {
type Pages = BTreeSet<GearPage>;
type Output = Status;

Expand Down Expand Up @@ -107,7 +107,7 @@ fn accesses_pages(
let last_byte = access
.offset
.checked_add(access.size.saturating_sub(1))
.ok_or_else(|| Error::OutOfWasmMemoryAccess)?;
.ok_or(Error::OutOfWasmMemoryAccess)?;

let start = (access.offset / page_size) * page_size;
let end = (last_byte / page_size) * page_size;
Expand Down
6 changes: 2 additions & 4 deletions lazy-pages/src/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ unsafe fn user_signal_handler_internal(
info: ExceptionInfo,
) -> Result<(), Error> {
let native_addr = info.fault_addr as usize;
let is_write = info.is_write.ok_or_else(|| Error::ReadOrWriteIsUnknown)?;
let wasm_mem_addr = exec_ctx
.wasm_mem_addr
.ok_or_else(|| Error::WasmMemAddrIsNotSet)?;
let is_write = info.is_write.ok_or(Error::ReadOrWriteIsUnknown)?;
let wasm_mem_addr = exec_ctx.wasm_mem_addr.ok_or(Error::WasmMemAddrIsNotSet)?;

if native_addr < wasm_mem_addr {
return Err(Error::OutOfWasmMemoryAccess);
Expand Down
6 changes: 3 additions & 3 deletions sandbox/host/src/store_refcell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ pub struct StoreRefCell<S> {

trait GenericAsStoreMut {}

impl<'r, 's> GenericAsStoreMut for &'r mut wasmer::StoreMut<'s> {}
impl<'s, T> GenericAsStoreMut for wasmi::StoreContextMut<'s, T> {}
impl GenericAsStoreMut for &mut wasmer::StoreMut<'_> {}
impl<T> GenericAsStoreMut for wasmi::StoreContextMut<'_, T> {}

#[derive(Debug)]
pub struct BorrowScopeError;
Expand Down Expand Up @@ -236,7 +236,7 @@ pub struct RefMut<'b, S> {
state: &'b Cell<BorrowState>,
}

impl<'a, S> Deref for RefMut<'a, S> {
impl<S> Deref for RefMut<'_, S> {
type Target = S;

#[inline]
Expand Down

0 comments on commit 6cb7ff0

Please sign in to comment.