Skip to content

Commit c958c9b

Browse files
committed
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<dyn RetryPolicy>`
1 parent fc4c8de commit c958c9b

File tree

4 files changed

+0
-28
lines changed

4 files changed

+0
-28
lines changed

scylla/src/transport/downgrading_consistency_retry_policy.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ impl RetryPolicy for DowngradingConsistencyRetryPolicy {
3030
fn new_session(&self) -> Box<dyn RetrySession> {
3131
Box::new(DowngradingConsistencyRetrySession::new())
3232
}
33-
34-
fn clone_boxed(&self) -> Box<dyn RetryPolicy> {
35-
Box::new(DowngradingConsistencyRetryPolicy)
36-
}
3733
}
3834

3935
pub struct DowngradingConsistencyRetrySession {

scylla/src/transport/retry_policy.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ pub enum RetryDecision {
2929
pub trait RetryPolicy: std::fmt::Debug + Send + Sync {
3030
/// Called for each new query, starts a session of deciding about retries
3131
fn new_session(&self) -> Box<dyn RetrySession>;
32-
33-
/// Used to clone this RetryPolicy
34-
fn clone_boxed(&self) -> Box<dyn RetryPolicy>;
35-
}
36-
37-
impl Clone for Box<dyn RetryPolicy> {
38-
fn clone(&self) -> Box<dyn RetryPolicy> {
39-
self.clone_boxed()
40-
}
4132
}
4233

4334
/// Used throughout a single query to decide when to retry it
@@ -71,10 +62,6 @@ impl RetryPolicy for FallthroughRetryPolicy {
7162
fn new_session(&self) -> Box<dyn RetrySession> {
7263
Box::new(FallthroughRetrySession)
7364
}
74-
75-
fn clone_boxed(&self) -> Box<dyn RetryPolicy> {
76-
Box::new(FallthroughRetryPolicy)
77-
}
7865
}
7966

8067
impl RetrySession for FallthroughRetrySession {
@@ -106,10 +93,6 @@ impl RetryPolicy for DefaultRetryPolicy {
10693
fn new_session(&self) -> Box<dyn RetrySession> {
10794
Box::new(DefaultRetrySession::new())
10895
}
109-
110-
fn clone_boxed(&self) -> Box<dyn RetryPolicy> {
111-
Box::new(DefaultRetryPolicy)
112-
}
11396
}
11497

11598
pub struct DefaultRetrySession {

scylla/src/transport/session_test.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,9 +2708,6 @@ async fn test_iter_works_when_retry_policy_returns_ignore_write_error() {
27082708
fn new_session(&self) -> Box<dyn RetrySession> {
27092709
Box::new(MyRetrySession(self.0.clone()))
27102710
}
2711-
fn clone_boxed(&self) -> Box<dyn RetryPolicy> {
2712-
Box::new(MyRetryPolicy(self.0.clone()))
2713-
}
27142711
}
27152712

27162713
struct MyRetrySession(Arc<AtomicBool>);

scylla/tests/integration/execution_profiles.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ impl<const NODE: u8> RetryPolicy for BoundToPredefinedNodePolicy<NODE> {
9595
self.report_node(Report::RetryPolicy);
9696
Box::new(self.clone())
9797
}
98-
99-
fn clone_boxed(&self) -> Box<dyn RetryPolicy> {
100-
Box::new(self.clone())
101-
}
10298
}
10399

104100
impl<const NODE: u8> RetrySession for BoundToPredefinedNodePolicy<NODE> {

0 commit comments

Comments
 (0)