From 803271266574a36bdd316cd6a8d0c7cabc094c9b Mon Sep 17 00:00:00 2001 From: Evgeny Ukhanov Date: Fri, 10 Jan 2025 13:32:15 +0100 Subject: [PATCH] Update to Rust 1.84 and fix clippy (#74) --- evm-tests/EIP-152/src/portable.rs | 2 +- evm-tests/ethjson/src/bytes.rs | 2 +- evm-tests/ethjson/src/uint.rs | 2 +- fuzzer/src/main.rs | 4 ++-- gasometer/src/lib.rs | 2 +- rust-toolchain.toml | 2 +- src/backend/memory.rs | 4 ++-- src/executor/stack/executor.rs | 12 ++++++------ src/executor/stack/memory.rs | 4 ++-- src/maybe_borrowed.rs | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/evm-tests/EIP-152/src/portable.rs b/evm-tests/EIP-152/src/portable.rs index 2b4e89070..589f91b9b 100644 --- a/evm-tests/EIP-152/src/portable.rs +++ b/evm-tests/EIP-152/src/portable.rs @@ -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 #[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); diff --git a/evm-tests/ethjson/src/bytes.rs b/evm-tests/ethjson/src/bytes.rs index 4e3c59537..dc3935548 100644 --- a/evm-tests/ethjson/src/bytes.rs +++ b/evm-tests/ethjson/src/bytes.rs @@ -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 { diff --git a/evm-tests/ethjson/src/uint.rs b/evm-tests/ethjson/src/uint.rs index 818ad4796..db91d3b86 100644 --- a/evm-tests/ethjson/src/uint.rs +++ b/evm-tests/ethjson/src/uint.rs @@ -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 { diff --git a/fuzzer/src/main.rs b/fuzzer/src/main.rs index fe946cd11..1a769cced 100644 --- a/fuzzer/src/main.rs +++ b/fuzzer/src/main.rs @@ -2,9 +2,9 @@ use evm_core::Machine; use std::rc::Rc; fn find_subsequence(haystack: &[u8], needle: &[u8]) -> Option { - return haystack + haystack .windows(needle.len()) - .position(|window| window == needle); + .position(|window| window == needle) } fn split_at_delim(sequence: &[u8], delim: &[u8]) -> (Vec, Vec) { diff --git a/gasometer/src/lib.rs b/gasometer/src/lib.rs index 4f46b4b4f..0b0d80444 100644 --- a/gasometer/src/lib.rs +++ b/gasometer/src/lib.rs @@ -878,7 +878,7 @@ struct Inner<'config> { config: &'config Config, } -impl<'config> Inner<'config> { +impl Inner<'_> { fn memory_gas(&self, memory: MemoryCost) -> Result { let from = memory.offset; let len = memory.len; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 812fd681e..097e68d18 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "1.82.0" +channel = "1.84.0" profile = "minimal" components = ["rustfmt", "clippy"] diff --git a/src/backend/memory.rs b/src/backend/memory.rs index 619897d62..c60f962e0 100644 --- a/src/backend/memory.rs +++ b/src/backend/memory.rs @@ -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 @@ -186,7 +186,7 @@ impl<'vicinity> Backend for MemoryBackend<'vicinity> { } } -impl<'vicinity> ApplyBackend for MemoryBackend<'vicinity> { +impl ApplyBackend for MemoryBackend<'_> { fn apply(&mut self, values: A, logs: L, delete_empty: bool) where A: IntoIterator>, diff --git a/src/executor/stack/executor.rs b/src/executor/stack/executor.rs index 8d8848860..2725cce22 100644 --- a/src/executor/stack/executor.rs +++ b/src/executor/stack/executor.rs @@ -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) {} @@ -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; @@ -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. diff --git a/src/executor/stack/memory.rs b/src/executor/stack/memory.rs index 367e25e42..d0709459d 100644 --- a/src/executor/stack/memory.rs +++ b/src/executor/stack/memory.rs @@ -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 Backend for MemoryStackState<'_, '_, B> { fn gas_price(&self) -> U256 { self.backend.gas_price() } @@ -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() } diff --git a/src/maybe_borrowed.rs b/src/maybe_borrowed.rs index c5dcc6866..a10644f51 100644 --- a/src/maybe_borrowed.rs +++ b/src/maybe_borrowed.rs @@ -14,7 +14,7 @@ pub enum MaybeBorrowed<'a, T> { Owned(T), } -impl<'a, T> core::ops::Deref for MaybeBorrowed<'a, T> { +impl core::ops::Deref for MaybeBorrowed<'_, T> { type Target = T; fn deref(&self) -> &Self::Target { @@ -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 core::ops::DerefMut for MaybeBorrowed<'_, T> { fn deref_mut(&mut self) -> &mut Self::Target { match self { Self::Borrowed(x) => x,