From 95c51247f73516f387e2169e63a22311b4343b8d Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Tue, 22 Jul 2025 12:18:54 -0400 Subject: [PATCH] fix: Replace smart pointer with regular pointer Apparently was not necessary and was causing clippy warnings. ``` warning: you seem to be trying to use `&Box`. Consider using just `&T` --> src/encoding/models.rs:91:32 | 91 | pub protocol_state: Option<&'a Box>, | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a dyn ProtocolSim` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box = note: `#[warn(clippy::borrowed_box)]` on by default ``` --- examples/uniswapx-encoding-example/main.rs | 3 +-- src/encoding/models.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/uniswapx-encoding-example/main.rs b/examples/uniswapx-encoding-example/main.rs index 928ffff..a35b1cb 100644 --- a/examples/uniswapx-encoding-example/main.rs +++ b/examples/uniswapx-encoding-example/main.rs @@ -167,7 +167,6 @@ fn main() { println!(" ====== Simple swap DAI -> USDT ======"); println!( "The following callback data should be sent to the filler contract, along with the \ - encoded order and signature: {:?}", - hex_calldata + encoded order and signature: {hex_calldata:?}" ); } diff --git a/src/encoding/models.rs b/src/encoding/models.rs index c590912..9ffc367 100644 --- a/src/encoding/models.rs +++ b/src/encoding/models.rs @@ -88,7 +88,7 @@ pub struct Swap<'a> { pub user_data: Option, /// Optional protocol state used to perform the swap. #[serde(skip)] - pub protocol_state: Option<&'a Box>, + pub protocol_state: Option<&'a dyn ProtocolSim>, } impl<'a> Swap<'a> { @@ -98,7 +98,7 @@ impl<'a> Swap<'a> { token_out: Bytes, split: f64, user_data: Option, - protocol_state: Option<&'a Box>, + protocol_state: Option<&'a dyn ProtocolSim>, ) -> Self { Self { component: component.into(), token_in, token_out, split, user_data, protocol_state } }