Skip to content

Commit

Permalink
refactor: Remove superfluous 'static bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Dec 19, 2024
1 parent 0ea12d2 commit 137de81
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
6 changes: 3 additions & 3 deletions tasm-lib/src/traits/accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ impl From<AccessorInitialState> for InitVmState {
}
}

pub struct ShadowedAccessor<T: Accessor + 'static> {
pub struct ShadowedAccessor<T: Accessor> {
accessor: T,
}

impl<T: Accessor + 'static> ShadowedAccessor<T> {
impl<T: Accessor> ShadowedAccessor<T> {
pub fn new(accessor: T) -> Self {
Self { accessor }
}
}

impl<T> RustShadow for ShadowedAccessor<T>
where
T: Accessor + 'static,
T: Accessor,
{
fn inner(&self) -> &dyn BasicSnippet {
&self.accessor
Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/traits/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ impl From<AlgorithmInitialState> for InitVmState {
}
}

pub struct ShadowedAlgorithm<T: Algorithm + 'static> {
pub struct ShadowedAlgorithm<T: Algorithm> {
algorithm: T,
}

impl<T: Algorithm + 'static> ShadowedAlgorithm<T> {
impl<T: Algorithm> ShadowedAlgorithm<T> {
pub fn new(algorithm: T) -> Self {
Self { algorithm }
}
}

impl<T> RustShadow for ShadowedAlgorithm<T>
where
T: Algorithm + 'static,
T: Algorithm,
{
fn inner(&self) -> &dyn BasicSnippet {
&self.algorithm
Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/traits/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ pub trait Closure: BasicSnippet {
}
}

pub struct ShadowedClosure<C: Closure + 'static> {
pub struct ShadowedClosure<C: Closure> {
closure: C,
}

impl<C: Closure + 'static> ShadowedClosure<C> {
impl<C: Closure> ShadowedClosure<C> {
pub fn new(closure: C) -> Self {
Self { closure }
}
}

impl<C: Closure + 'static> RustShadow for ShadowedClosure<C> {
impl<C: Closure> RustShadow for ShadowedClosure<C> {
fn inner(&self) -> &dyn BasicSnippet {
&self.closure
}
Expand Down
2 changes: 1 addition & 1 deletion tasm-lib/src/traits/deprecated_snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ pub(crate) mod tests {
}
}

impl<S: DeprecatedSnippet + Clone + 'static> RustShadow for DeprecatedSnippetWrapper<S> {
impl<S: DeprecatedSnippet + Clone> RustShadow for DeprecatedSnippetWrapper<S> {
fn inner(&self) -> &dyn BasicSnippet {
&self.deprecated_snippet
}
Expand Down
8 changes: 4 additions & 4 deletions tasm-lib/src/traits/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ impl From<FunctionInitialState> for InitVmState {
}
}

pub struct ShadowedFunction<F: Function + 'static> {
pub struct ShadowedFunction<F: Function> {
function: F,
}

impl<F: Function + 'static> ShadowedFunction<F> {
impl<F: Function> ShadowedFunction<F> {
pub fn new(function: F) -> Self {
Self { function }
}
}

impl<P: Function + 'static> ShadowedFunction<P> {
impl<P: Function> ShadowedFunction<P> {
fn test_initial_state(&self, state: FunctionInitialState) {
let FunctionInitialState { stack, memory } = state;

Expand All @@ -99,7 +99,7 @@ impl<P: Function + 'static> ShadowedFunction<P> {

impl<F> RustShadow for ShadowedFunction<F>
where
F: Function + 'static,
F: Function,
{
fn inner(&self) -> &dyn BasicSnippet {
&self.function
Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/traits/mem_preserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ impl From<MemPreserverInitialState> for InitVmState {
}
}

pub struct ShadowedMemPreserver<T: MemPreserver + 'static> {
pub struct ShadowedMemPreserver<T: MemPreserver> {
mem_preserver: T,
}

impl<T: MemPreserver + 'static> ShadowedMemPreserver<T> {
impl<T: MemPreserver> ShadowedMemPreserver<T> {
pub fn new(mem_preserver: T) -> Self {
Self { mem_preserver }
}
}

impl<T> RustShadow for ShadowedMemPreserver<T>
where
T: MemPreserver + 'static,
T: MemPreserver,
{
fn inner(&self) -> &dyn BasicSnippet {
&self.mem_preserver
Expand Down
8 changes: 4 additions & 4 deletions tasm-lib/src/traits/procedure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ impl From<ProcedureInitialState> for InitVmState {
}
}

pub struct ShadowedProcedure<P: Procedure + 'static> {
pub struct ShadowedProcedure<P: Procedure> {
procedure: P,
}

impl<P: Procedure + 'static> ShadowedProcedure<P> {
impl<P: Procedure> ShadowedProcedure<P> {
pub fn new(procedure: P) -> Self {
Self { procedure }
}
}

impl<P: Procedure + 'static> RustShadow for ShadowedProcedure<P> {
impl<P: Procedure> RustShadow for ShadowedProcedure<P> {
fn inner(&self) -> &dyn BasicSnippet {
&self.procedure
}
Expand Down Expand Up @@ -150,7 +150,7 @@ impl<P: Procedure + 'static> RustShadow for ShadowedProcedure<P> {
}
}

impl<P: Procedure + 'static> ShadowedProcedure<P> {
impl<P: Procedure> ShadowedProcedure<P> {
fn test_initial_state(&self, state: ProcedureInitialState) {
test_rust_equivalence_given_complete_state(
self,
Expand Down
6 changes: 3 additions & 3 deletions tasm-lib/src/traits/read_only_algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,19 @@ impl From<ReadOnlyAlgorithmInitialState> for InitVmState {
}
}

pub struct ShadowedReadOnlyAlgorithm<T: ReadOnlyAlgorithm + 'static> {
pub struct ShadowedReadOnlyAlgorithm<T: ReadOnlyAlgorithm> {
algorithm: T,
}

impl<T: ReadOnlyAlgorithm + 'static> ShadowedReadOnlyAlgorithm<T> {
impl<T: ReadOnlyAlgorithm> ShadowedReadOnlyAlgorithm<T> {
pub fn new(algorithm: T) -> Self {
Self { algorithm }
}
}

impl<T> RustShadow for ShadowedReadOnlyAlgorithm<T>
where
T: ReadOnlyAlgorithm + 'static,
T: ReadOnlyAlgorithm,
{
fn inner(&self) -> &dyn BasicSnippet {
&self.algorithm
Expand Down
3 changes: 1 addition & 2 deletions tasm-lib/src/traits/rust_shadow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 137de81

Please sign in to comment.