Skip to content

Commit

Permalink
Update to Rust 1.84 and fix clippy (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrLSD authored Jan 10, 2025
1 parent 39145ee commit 8032712
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion evm-tests/EIP-152/src/portable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use crate::{IV, SIGMA};

/// The G mixing function. See https://tools.ietf.org/html/rfc7693#section-3.1
/// The G mixing function. See <https://tools.ietf.org/html/rfc7693#section-3.1>
#[inline(always)]
fn g(v: &mut [u64], a: usize, b: usize, c: usize, d: usize, x: u64, y: u64) {
v[a] = v[a].wrapping_add(v[b]).wrapping_add(x);
Expand Down
2 changes: 1 addition & 1 deletion evm-tests/ethjson/src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'a> Deserialize<'a> for Bytes {

struct BytesVisitor;

impl<'a> Visitor<'a> for BytesVisitor {
impl Visitor<'_> for BytesVisitor {
type Value = Bytes;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion evm-tests/ethjson/src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'a> Deserialize<'a> for Uint {

struct UintVisitor;

impl<'a> Visitor<'a> for UintVisitor {
impl Visitor<'_> for UintVisitor {
type Value = Uint;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions fuzzer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use evm_core::Machine;
use std::rc::Rc;

fn find_subsequence(haystack: &[u8], needle: &[u8]) -> Option<usize> {
return haystack
haystack
.windows(needle.len())
.position(|window| window == needle);
.position(|window| window == needle)
}

fn split_at_delim(sequence: &[u8], delim: &[u8]) -> (Vec<u8>, Vec<u8>) {
Expand Down
2 changes: 1 addition & 1 deletion gasometer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ struct Inner<'config> {
config: &'config Config,
}

impl<'config> Inner<'config> {
impl Inner<'_> {
fn memory_gas(&self, memory: MemoryCost) -> Result<u64, ExitError> {
let from = memory.offset;
let len = memory.len;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.82.0"
channel = "1.84.0"
profile = "minimal"
components = ["rustfmt", "clippy"]
4 changes: 2 additions & 2 deletions src/backend/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'vicinity> MemoryBackend<'vicinity> {
}
}

impl<'vicinity> Backend for MemoryBackend<'vicinity> {
impl Backend for MemoryBackend<'_> {
#[allow(clippy::misnamed_getters)]
fn gas_price(&self) -> U256 {
self.vicinity.effective_gas_price
Expand Down Expand Up @@ -186,7 +186,7 @@ impl<'vicinity> Backend for MemoryBackend<'vicinity> {
}
}

impl<'vicinity> ApplyBackend for MemoryBackend<'vicinity> {
impl ApplyBackend for MemoryBackend<'_> {
fn apply<A, I, L>(&mut self, values: A, logs: L, delete_empty: bool)
where
A: IntoIterator<Item = Apply<I>>,
Expand Down
12 changes: 6 additions & 6 deletions src/executor/stack/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,8 @@ impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet>
}
}

impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> InterpreterHandler
for StackExecutor<'config, 'precompiles, S, P>
impl<'config, S: StackState<'config>, P: PrecompileSet> InterpreterHandler
for StackExecutor<'config, '_, S, P>
{
#[inline]
fn before_eval(&mut self) {}
Expand Down Expand Up @@ -1248,8 +1248,8 @@ pub struct StackExecutorCallInterrupt<'borrow>(TaggedRuntime<'borrow>);

pub struct StackExecutorCreateInterrupt<'borrow>(TaggedRuntime<'borrow>);

impl<'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> Handler
for StackExecutor<'config, 'precompiles, S, P>
impl<'config, S: StackState<'config>, P: PrecompileSet> Handler
for StackExecutor<'config, '_, S, P>
{
type CreateInterrupt = StackExecutorCreateInterrupt<'static>;
type CreateFeedback = Infallible;
Expand Down Expand Up @@ -1543,8 +1543,8 @@ struct StackExecutorHandle<'inner, 'config, 'precompiles, S, P> {
is_static: bool,
}

impl<'inner, 'config, 'precompiles, S: StackState<'config>, P: PrecompileSet> PrecompileHandle
for StackExecutorHandle<'inner, 'config, 'precompiles, S, P>
impl<'config, S: StackState<'config>, P: PrecompileSet> PrecompileHandle
for StackExecutorHandle<'_, 'config, '_, S, P>
{
// Perform subcall in provided context.
/// Precompile specifies in which context the subcall is executed.
Expand Down
4 changes: 2 additions & 2 deletions src/executor/stack/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ pub struct MemoryStackState<'backend, 'config, B> {
substate: MemoryStackSubstate<'config>,
}

impl<'backend, 'config, B: Backend> Backend for MemoryStackState<'backend, 'config, B> {
impl<B: Backend> Backend for MemoryStackState<'_, '_, B> {
fn gas_price(&self) -> U256 {
self.backend.gas_price()
}
Expand Down Expand Up @@ -576,7 +576,7 @@ impl<'backend, 'config, B: Backend> Backend for MemoryStackState<'backend, 'conf
}
}

impl<'backend, 'config, B: Backend> StackState<'config> for MemoryStackState<'backend, 'config, B> {
impl<'config, B: Backend> StackState<'config> for MemoryStackState<'_, 'config, B> {
fn metadata(&self) -> &StackSubstateMetadata<'config> {
self.substate.metadata()
}
Expand Down
4 changes: 2 additions & 2 deletions src/maybe_borrowed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum MaybeBorrowed<'a, T> {
Owned(T),
}

impl<'a, T> core::ops::Deref for MaybeBorrowed<'a, T> {
impl<T> core::ops::Deref for MaybeBorrowed<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
Expand All @@ -25,7 +25,7 @@ impl<'a, T> core::ops::Deref for MaybeBorrowed<'a, T> {
}
}

impl<'a, T> core::ops::DerefMut for MaybeBorrowed<'a, T> {
impl<T> core::ops::DerefMut for MaybeBorrowed<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
match self {
Self::Borrowed(x) => x,
Expand Down

0 comments on commit 8032712

Please sign in to comment.