Skip to content

Commit

Permalink
Apply clippy --fix - removing lots of unnecessary lifetime annotati…
Browse files Browse the repository at this point in the history
…ons (#1220)

apply clippy --fix
  • Loading branch information
Robbepop authored Oct 4, 2024
1 parent fff26d9 commit ad46b8b
Show file tree
Hide file tree
Showing 26 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion crates/cli/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'a> From<&'a Val> for DisplayValue<'a> {
}
}

impl<'a> fmt::Display for DisplayValue<'a> {
impl fmt::Display for DisplayValue<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.0 {
Val::I32(value) => write!(f, "{value}"),
Expand Down
2 changes: 1 addition & 1 deletion crates/collections/src/arena/component_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where

struct DebugComponents<'a, T>(&'a [Option<T>]);

impl<'a, T> Debug for DebugComponents<'a, T>
impl<T> Debug for DebugComponents<'_, T>
where
T: Debug,
{
Expand Down
8 changes: 4 additions & 4 deletions crates/collections/src/arena/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ where
}
}

impl<'a, Idx, T> DoubleEndedIterator for Iter<'a, Idx, T>
impl<Idx, T> DoubleEndedIterator for Iter<'_, Idx, T>
where
Idx: ArenaIndex,
{
Expand All @@ -245,7 +245,7 @@ where
}
}

impl<'a, Idx, T> ExactSizeIterator for Iter<'a, Idx, T>
impl<Idx, T> ExactSizeIterator for Iter<'_, Idx, T>
where
Idx: ArenaIndex,
{
Expand Down Expand Up @@ -281,7 +281,7 @@ where
}
}

impl<'a, Idx, T> DoubleEndedIterator for IterMut<'a, Idx, T>
impl<Idx, T> DoubleEndedIterator for IterMut<'_, Idx, T>
where
Idx: ArenaIndex,
{
Expand All @@ -293,7 +293,7 @@ where
}
}

impl<'a, Idx, T> ExactSizeIterator for IterMut<'a, Idx, T>
impl<Idx, T> ExactSizeIterator for IterMut<'_, Idx, T>
where
Idx: ArenaIndex,
{
Expand Down
8 changes: 4 additions & 4 deletions crates/ir/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ impl<'a> Iterator for InstrIter<'a> {
}
}

impl<'a> DoubleEndedIterator for InstrIter<'a> {
impl DoubleEndedIterator for InstrIter<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.instrs.next_back()
}
}

impl<'a> ExactSizeIterator for InstrIter<'a> {}
impl ExactSizeIterator for InstrIter<'_> {}

/// Iterator yielding the [`Instruction`]s of an [`InstrSequence`] mutably.
#[derive(Debug)]
Expand Down Expand Up @@ -220,10 +220,10 @@ impl<'a> Iterator for InstrIterMut<'a> {
}
}

impl<'a> DoubleEndedIterator for InstrIterMut<'a> {
impl DoubleEndedIterator for InstrIterMut<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.instrs.next_back()
}
}

impl<'a> ExactSizeIterator for InstrIterMut<'a> {}
impl ExactSizeIterator for InstrIterMut<'_> {}
4 changes: 2 additions & 2 deletions crates/ir/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<const N: u16> FixedRegSpan<N> {
}
}

impl<'a, const N: u16> IntoIterator for &'a FixedRegSpan<N> {
impl<const N: u16> IntoIterator for &FixedRegSpan<N> {
type Item = Reg;
type IntoIter = RegSpanIter;

Expand Down Expand Up @@ -187,7 +187,7 @@ impl BoundedRegSpan {
}
}

impl<'a> IntoIterator for &'a BoundedRegSpan {
impl IntoIterator for &BoundedRegSpan {
type Item = Reg;
type IntoIter = RegSpanIter;

Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/executor/instrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ macro_rules! get_entity {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
get_entity! {
fn get_func(&self, index: index::Func) -> Func;
fn get_func_type_dedup(&self, index: index::FuncType) -> DedupFuncType;
Expand Down Expand Up @@ -1725,7 +1725,7 @@ impl<'engine> Executor<'engine> {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Used for all [`Instruction`] words that are not meant for execution.
///
/// # Note
Expand Down
16 changes: 8 additions & 8 deletions crates/wasmi/src/engine/executor/instrs/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro_rules! impl_binary {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_binary! {
(Instruction::I32Add, execute_i32_add, UntypedVal::i32_add),
(Instruction::I32Sub, execute_i32_sub, UntypedVal::i32_sub),
Expand Down Expand Up @@ -78,7 +78,7 @@ macro_rules! impl_binary_imm16 {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_binary_imm16! {
(i32, Instruction::I32AddImm16, execute_i32_add_imm16, UntypedVal::i32_add),
(i32, Instruction::I32MulImm16, execute_i32_mul_imm16, UntypedVal::i32_mul),
Expand Down Expand Up @@ -120,7 +120,7 @@ macro_rules! impl_binary_imm16_rev {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_binary_imm16_rev! {
(i32, Instruction::I32SubImm16Rev, execute_i32_sub_imm16_rev, UntypedVal::i32_sub),
(i64, Instruction::I64SubImm16Rev, execute_i64_sub_imm16_rev, UntypedVal::i64_sub),
Expand Down Expand Up @@ -149,7 +149,7 @@ macro_rules! impl_fallible_binary {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_fallible_binary! {
(Instruction::I32DivS, execute_i32_div_s, UntypedVal::i32_div_s),
(Instruction::I32DivU, execute_i32_div_u, UntypedVal::i32_div_u),
Expand Down Expand Up @@ -240,7 +240,7 @@ macro_rules! impl_divrem_s_imm16 {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_divrem_s_imm16! {
(NonZeroI32, Instruction::I32DivSImm16, execute_i32_div_s_imm16, <UntypedVal as DivRemExt>::i32_div_s),
(NonZeroI32, Instruction::I32RemSImm16, execute_i32_rem_s_imm16, <UntypedVal as DivRemExt>::i32_rem_s),
Expand All @@ -260,7 +260,7 @@ macro_rules! impl_divrem_u_imm16 {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_divrem_u_imm16! {
(NonZeroU32, Instruction::I32DivUImm16, execute_i32_div_u_imm16, <UntypedVal as DivRemExt>::i32_div_u),
(NonZeroU32, Instruction::I32RemUImm16, execute_i32_rem_u_imm16, <UntypedVal as DivRemExt>::i32_rem_u),
Expand All @@ -280,7 +280,7 @@ macro_rules! impl_fallible_binary_imm16_rev {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_fallible_binary_imm16_rev! {
(i32, Instruction::I32DivSImm16Rev, execute_i32_div_s_imm16_rev, UntypedVal::i32_div_s),
(u32, Instruction::I32DivUImm16Rev, execute_i32_div_u_imm16_rev, UntypedVal::i32_div_u),
Expand All @@ -294,7 +294,7 @@ impl<'engine> Executor<'engine> {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Executes an [`Instruction::F32CopysignImm`].
pub fn execute_f32_copysign_imm(&mut self, result: Reg, lhs: Reg, rhs: Sign<f32>) {
let lhs = self.get_register(lhs);
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/executor/instrs/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
};
use core::cmp;

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Branches and adjusts the value stack.
///
/// # Note
Expand Down Expand Up @@ -398,7 +398,7 @@ impl_execute_branch_binop_imm! {
(u64, Instruction::BranchI64GeUImm, execute_branch_i64_ge_u_imm, cmp_ge),
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Executes an [`Instruction::BranchCmpFallback`].
pub fn execute_branch_cmp_fallback(&mut self, lhs: Reg, rhs: Reg, params: Reg) {
use Comparator as C;
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ mod marker {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Updates the [`InstructionPtr`] of the caller [`CallFrame`] before dispatching a call.
///
/// # Note
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/executor/instrs/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ macro_rules! impl_comparison {
};
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_comparison! {
(Instruction::I32Eq, execute_i32_eq, UntypedVal::i32_eq),
(Instruction::I32Ne, execute_i32_ne, UntypedVal::i32_ne),
Expand Down Expand Up @@ -69,7 +69,7 @@ macro_rules! impl_comparison_imm16 {
};
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_comparison_imm16! {
(i32, Instruction::I32EqImm16, execute_i32_eq_imm16, UntypedVal::i32_eq),
(i32, Instruction::I32NeImm16, execute_i32_ne_imm16, UntypedVal::i32_ne),
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ macro_rules! impl_fallible_conversion_impls {
};
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_conversion_impls! {
(Instruction::I32WrapI64, execute_i32_wrap_i64, UntypedVal::i32_wrap_i64),

Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
use core::slice;
use smallvec::SmallVec;

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Executes a generic `copy` [`Instruction`].
fn execute_copy_impl<T>(&mut self, result: Reg, value: T, f: fn(&mut Self, T) -> UntypedVal) {
let value = f(self, value);
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
#[cfg(doc)]
use crate::engine::bytecode::Instruction;

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Executes an [`Instruction::GlobalGet`].
pub fn execute_global_get(&mut self, store: &StoreInner, result: Reg, global: index::Global) {
let value = match u32::from(global) {
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/executor/instrs/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
type WasmLoadOp =
fn(memory: &[u8], address: UntypedVal, offset: u32) -> Result<UntypedVal, TrapCode>;

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Returns the `ptr` and `offset` parameters for a `load` [`Instruction`].
fn fetch_ptr_and_offset(&self) -> (Reg, u32) {
let mut addr: InstructionPtr = self.ip;
Expand Down Expand Up @@ -208,7 +208,7 @@ macro_rules! impl_execute_load {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_execute_load! {
(
(Instruction::I32Load, execute_i32_load),
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
Store,
};

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Returns the [`Instruction::MemoryIndex`] parameter for an [`Instruction`].
fn fetch_memory_index(&self, offset: usize) -> Memory {
let mut addr: InstructionPtr = self.ip;
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/return_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub enum ReturnOutcome {
Host,
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Returns the execution to the caller.
///
/// Any return values are expected to already have been transferred
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmi/src/engine/executor/instrs/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type WasmStoreOp = fn(
value: UntypedVal,
) -> Result<(), TrapCode>;

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Returns the register `value` and `offset` parameters for a `load` [`Instruction`].
fn fetch_value_and_offset(&self) -> (Reg, u32) {
let mut addr: InstructionPtr = self.ip;
Expand Down Expand Up @@ -324,7 +324,7 @@ macro_rules! impl_execute_istore {
)*
};
}
impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_execute_istore! {
(
(Const16<i32> => i32),
Expand Down Expand Up @@ -432,7 +432,7 @@ macro_rules! impl_execute_fstore {
}
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_execute_fstore! {
(
(Instruction::F32Store, execute_f32_store),
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
Store,
};

impl<'engine> Executor<'engine> {
impl Executor<'_> {
/// Returns the [`Instruction::TableIndex`] parameter for an [`Instruction`].
fn fetch_table_index(&self, offset: usize) -> Table {
let mut addr: InstructionPtr = self.ip;
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/executor/instrs/unary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro_rules! impl_unary_impls {
};
}

impl<'engine> Executor<'engine> {
impl Executor<'_> {
impl_unary_impls! {
(Instruction::I32Clz, execute_i32_clz, UntypedVal::i32_clz),
(Instruction::I32Ctz, execute_i32_ctz, UntypedVal::i32_ctz),
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CallParamsValueIter<'a> {
iter: iter::Cloned<slice::Iter<'a, Val>>,
}

impl<'a> Iterator for CallParamsValueIter<'a> {
impl Iterator for CallParamsValueIter<'_> {
type Item = UntypedVal;

#[inline]
Expand Down Expand Up @@ -76,7 +76,7 @@ pub trait CallResults {
fn call_results(self, results: &[UntypedVal]) -> Self::Results;
}

impl<'a> CallResults for &'a mut [Val] {
impl CallResults for &mut [Val] {
type Results = ();

fn len_results(&self) -> usize {
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmi/src/engine/translator/labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub struct ResolvedUserIter<'a> {
registry: &'a LabelRegistry,
}

impl<'a> Iterator for ResolvedUserIter<'a> {
impl Iterator for ResolvedUserIter<'_> {
type Item = (Instr, Result<BranchOffset, Error>);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
4 changes: 2 additions & 2 deletions crates/wasmi/src/engine/translator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl LazyFuncTranslator {
}
}

impl<'parser> WasmTranslator<'parser> for LazyFuncTranslator {
impl WasmTranslator<'_> for LazyFuncTranslator {
type Allocations = ();

fn setup(&mut self, bytes: &[u8]) -> Result<bool, Error> {
Expand Down Expand Up @@ -519,7 +519,7 @@ pub struct FuncTranslator {
alloc: FuncTranslatorAllocations,
}

impl<'parser> WasmTranslator<'parser> for FuncTranslator {
impl WasmTranslator<'_> for FuncTranslator {
type Allocations = FuncTranslatorAllocations;

fn setup(&mut self, _bytes: &[u8]) -> Result<bool, Error> {
Expand Down
Loading

0 comments on commit ad46b8b

Please sign in to comment.