From e2fbbf22909f84c79d8bcfe21c7cb9695d855a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Uzarski?= Date: Thu, 24 Oct 2024 16:34:39 +0200 Subject: [PATCH] retry_policy: remove clone_boxed() method from RetryPolicy trait Again, from now on we will prefer storing dyn RetryPolicy behind an Arc. There is no need for `clone_boxed` method anymore. Removed `impl Clone for Box` --- .../downgrading_consistency_retry_policy.rs | 4 ---- scylla/src/transport/retry_policy.rs | 17 ----------------- scylla/src/transport/session_test.rs | 3 --- scylla/tests/integration/execution_profiles.rs | 4 ---- 4 files changed, 28 deletions(-) diff --git a/scylla/src/transport/downgrading_consistency_retry_policy.rs b/scylla/src/transport/downgrading_consistency_retry_policy.rs index 51fcdfd3e..e52a44cbf 100644 --- a/scylla/src/transport/downgrading_consistency_retry_policy.rs +++ b/scylla/src/transport/downgrading_consistency_retry_policy.rs @@ -30,10 +30,6 @@ impl RetryPolicy for DowngradingConsistencyRetryPolicy { fn new_session(&self) -> Box { Box::new(DowngradingConsistencyRetrySession::new()) } - - fn clone_boxed(&self) -> Box { - Box::new(DowngradingConsistencyRetryPolicy) - } } pub struct DowngradingConsistencyRetrySession { diff --git a/scylla/src/transport/retry_policy.rs b/scylla/src/transport/retry_policy.rs index 44baa4424..54f87380e 100644 --- a/scylla/src/transport/retry_policy.rs +++ b/scylla/src/transport/retry_policy.rs @@ -29,15 +29,6 @@ pub enum RetryDecision { pub trait RetryPolicy: std::fmt::Debug + Send + Sync { /// Called for each new query, starts a session of deciding about retries fn new_session(&self) -> Box; - - /// Used to clone this RetryPolicy - fn clone_boxed(&self) -> Box; -} - -impl Clone for Box { - fn clone(&self) -> Box { - self.clone_boxed() - } } /// Used throughout a single query to decide when to retry it @@ -71,10 +62,6 @@ impl RetryPolicy for FallthroughRetryPolicy { fn new_session(&self) -> Box { Box::new(FallthroughRetrySession) } - - fn clone_boxed(&self) -> Box { - Box::new(FallthroughRetryPolicy) - } } impl RetrySession for FallthroughRetrySession { @@ -106,10 +93,6 @@ impl RetryPolicy for DefaultRetryPolicy { fn new_session(&self) -> Box { Box::new(DefaultRetrySession::new()) } - - fn clone_boxed(&self) -> Box { - Box::new(DefaultRetryPolicy) - } } pub struct DefaultRetrySession { diff --git a/scylla/src/transport/session_test.rs b/scylla/src/transport/session_test.rs index 41382d425..bfaed4d51 100644 --- a/scylla/src/transport/session_test.rs +++ b/scylla/src/transport/session_test.rs @@ -2708,9 +2708,6 @@ async fn test_iter_works_when_retry_policy_returns_ignore_write_error() { fn new_session(&self) -> Box { Box::new(MyRetrySession(self.0.clone())) } - fn clone_boxed(&self) -> Box { - Box::new(MyRetryPolicy(self.0.clone())) - } } struct MyRetrySession(Arc); diff --git a/scylla/tests/integration/execution_profiles.rs b/scylla/tests/integration/execution_profiles.rs index 6e723c9ef..0a49bae78 100644 --- a/scylla/tests/integration/execution_profiles.rs +++ b/scylla/tests/integration/execution_profiles.rs @@ -95,10 +95,6 @@ impl RetryPolicy for BoundToPredefinedNodePolicy { self.report_node(Report::RetryPolicy); Box::new(self.clone()) } - - fn clone_boxed(&self) -> Box { - Box::new(self.clone()) - } } impl RetrySession for BoundToPredefinedNodePolicy {