From 137de8116a01f140dcc397018dfeb37781749972 Mon Sep 17 00:00:00 2001 From: Jan Ferdinand Sauer Date: Thu, 19 Dec 2024 17:13:38 +0100 Subject: [PATCH] refactor: Remove superfluous `'static` bounds --- tasm-lib/src/traits/accessor.rs | 6 +++--- tasm-lib/src/traits/algorithm.rs | 6 +++--- tasm-lib/src/traits/closure.rs | 6 +++--- tasm-lib/src/traits/deprecated_snippet.rs | 2 +- tasm-lib/src/traits/function.rs | 8 ++++---- tasm-lib/src/traits/mem_preserver.rs | 6 +++--- tasm-lib/src/traits/procedure.rs | 8 ++++---- tasm-lib/src/traits/read_only_algorithm.rs | 6 +++--- tasm-lib/src/traits/rust_shadow.rs | 3 +-- 9 files changed, 25 insertions(+), 26 deletions(-) diff --git a/tasm-lib/src/traits/accessor.rs b/tasm-lib/src/traits/accessor.rs index a6a8ee43..b69d3967 100644 --- a/tasm-lib/src/traits/accessor.rs +++ b/tasm-lib/src/traits/accessor.rs @@ -63,11 +63,11 @@ impl From for InitVmState { } } -pub struct ShadowedAccessor { +pub struct ShadowedAccessor { accessor: T, } -impl ShadowedAccessor { +impl ShadowedAccessor { pub fn new(accessor: T) -> Self { Self { accessor } } @@ -75,7 +75,7 @@ impl ShadowedAccessor { impl RustShadow for ShadowedAccessor where - T: Accessor + 'static, + T: Accessor, { fn inner(&self) -> &dyn BasicSnippet { &self.accessor diff --git a/tasm-lib/src/traits/algorithm.rs b/tasm-lib/src/traits/algorithm.rs index 9d9022b2..7e122534 100644 --- a/tasm-lib/src/traits/algorithm.rs +++ b/tasm-lib/src/traits/algorithm.rs @@ -84,11 +84,11 @@ impl From for InitVmState { } } -pub struct ShadowedAlgorithm { +pub struct ShadowedAlgorithm { algorithm: T, } -impl ShadowedAlgorithm { +impl ShadowedAlgorithm { pub fn new(algorithm: T) -> Self { Self { algorithm } } @@ -96,7 +96,7 @@ impl ShadowedAlgorithm { impl RustShadow for ShadowedAlgorithm where - T: Algorithm + 'static, + T: Algorithm, { fn inner(&self) -> &dyn BasicSnippet { &self.algorithm diff --git a/tasm-lib/src/traits/closure.rs b/tasm-lib/src/traits/closure.rs index 73ad7427..4b89a17c 100644 --- a/tasm-lib/src/traits/closure.rs +++ b/tasm-lib/src/traits/closure.rs @@ -49,17 +49,17 @@ pub trait Closure: BasicSnippet { } } -pub struct ShadowedClosure { +pub struct ShadowedClosure { closure: C, } -impl ShadowedClosure { +impl ShadowedClosure { pub fn new(closure: C) -> Self { Self { closure } } } -impl RustShadow for ShadowedClosure { +impl RustShadow for ShadowedClosure { fn inner(&self) -> &dyn BasicSnippet { &self.closure } diff --git a/tasm-lib/src/traits/deprecated_snippet.rs b/tasm-lib/src/traits/deprecated_snippet.rs index 78260b6e..7ca9e39e 100644 --- a/tasm-lib/src/traits/deprecated_snippet.rs +++ b/tasm-lib/src/traits/deprecated_snippet.rs @@ -256,7 +256,7 @@ pub(crate) mod tests { } } - impl RustShadow for DeprecatedSnippetWrapper { + impl RustShadow for DeprecatedSnippetWrapper { fn inner(&self) -> &dyn BasicSnippet { &self.deprecated_snippet } diff --git a/tasm-lib/src/traits/function.rs b/tasm-lib/src/traits/function.rs index aadd3bbb..ae931ac8 100644 --- a/tasm-lib/src/traits/function.rs +++ b/tasm-lib/src/traits/function.rs @@ -66,17 +66,17 @@ impl From for InitVmState { } } -pub struct ShadowedFunction { +pub struct ShadowedFunction { function: F, } -impl ShadowedFunction { +impl ShadowedFunction { pub fn new(function: F) -> Self { Self { function } } } -impl ShadowedFunction

{ +impl ShadowedFunction

{ fn test_initial_state(&self, state: FunctionInitialState) { let FunctionInitialState { stack, memory } = state; @@ -99,7 +99,7 @@ impl ShadowedFunction

{ impl RustShadow for ShadowedFunction where - F: Function + 'static, + F: Function, { fn inner(&self) -> &dyn BasicSnippet { &self.function diff --git a/tasm-lib/src/traits/mem_preserver.rs b/tasm-lib/src/traits/mem_preserver.rs index 2692b44b..de07bf36 100644 --- a/tasm-lib/src/traits/mem_preserver.rs +++ b/tasm-lib/src/traits/mem_preserver.rs @@ -68,11 +68,11 @@ impl From for InitVmState { } } -pub struct ShadowedMemPreserver { +pub struct ShadowedMemPreserver { mem_preserver: T, } -impl ShadowedMemPreserver { +impl ShadowedMemPreserver { pub fn new(mem_preserver: T) -> Self { Self { mem_preserver } } @@ -80,7 +80,7 @@ impl ShadowedMemPreserver { impl RustShadow for ShadowedMemPreserver where - T: MemPreserver + 'static, + T: MemPreserver, { fn inner(&self) -> &dyn BasicSnippet { &self.mem_preserver diff --git a/tasm-lib/src/traits/procedure.rs b/tasm-lib/src/traits/procedure.rs index 44f3a856..87ea9a18 100644 --- a/tasm-lib/src/traits/procedure.rs +++ b/tasm-lib/src/traits/procedure.rs @@ -73,17 +73,17 @@ impl From for InitVmState { } } -pub struct ShadowedProcedure { +pub struct ShadowedProcedure { procedure: P, } -impl ShadowedProcedure

{ +impl ShadowedProcedure

{ pub fn new(procedure: P) -> Self { Self { procedure } } } -impl RustShadow for ShadowedProcedure

{ +impl RustShadow for ShadowedProcedure

{ fn inner(&self) -> &dyn BasicSnippet { &self.procedure } @@ -150,7 +150,7 @@ impl RustShadow for ShadowedProcedure

{ } } -impl ShadowedProcedure

{ +impl ShadowedProcedure

{ fn test_initial_state(&self, state: ProcedureInitialState) { test_rust_equivalence_given_complete_state( self, diff --git a/tasm-lib/src/traits/read_only_algorithm.rs b/tasm-lib/src/traits/read_only_algorithm.rs index 453b0f6b..26acc53f 100644 --- a/tasm-lib/src/traits/read_only_algorithm.rs +++ b/tasm-lib/src/traits/read_only_algorithm.rs @@ -64,11 +64,11 @@ impl From for InitVmState { } } -pub struct ShadowedReadOnlyAlgorithm { +pub struct ShadowedReadOnlyAlgorithm { algorithm: T, } -impl ShadowedReadOnlyAlgorithm { +impl ShadowedReadOnlyAlgorithm { pub fn new(algorithm: T) -> Self { Self { algorithm } } @@ -76,7 +76,7 @@ impl ShadowedReadOnlyAlgorithm { impl RustShadow for ShadowedReadOnlyAlgorithm where - T: ReadOnlyAlgorithm + 'static, + T: ReadOnlyAlgorithm, { fn inner(&self) -> &dyn BasicSnippet { &self.algorithm diff --git a/tasm-lib/src/traits/rust_shadow.rs b/tasm-lib/src/traits/rust_shadow.rs index a5fbc30e..df5a449a 100644 --- a/tasm-lib/src/traits/rust_shadow.rs +++ b/tasm-lib/src/traits/rust_shadow.rs @@ -2,8 +2,7 @@ use std::collections::HashMap; use triton_vm::prelude::*; -use super::basic_snippet::BasicSnippet; -use crate::prelude::Tip5; +use crate::prelude::*; pub trait RustShadow { fn inner(&self) -> &dyn BasicSnippet;