~soywod/pimalaya

use new_boxed instead of new v1 APPLIED

Perma Alesheikh: 1
 use new_boxed instead of new

 3 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~soywod/pimalaya/patches/49785/mbox | git am -3
Learn more about email & git

[PATCH] use new_boxed instead of new Export this patch

Since 'new' functions are usually reserved for functions that return
Self, we should use the new_boxed funcion.

Signed-off-by: Perma Alesheikh <me@prma.dev>
---
 time/examples/pomodoro-tcp.rs      | 2 +-
 time/src/client/tcp.rs             | 2 +-
 time/tests/multiple-tcp-clients.rs | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/time/examples/pomodoro-tcp.rs b/time/examples/pomodoro-tcp.rs
index e7dbea1..29e2125 100644
--- a/time/examples/pomodoro-tcp.rs
+++ b/time/examples/pomodoro-tcp.rs
@@ -29,7 +29,7 @@ async fn main() {
            // wait for the binder to be ready
            tokio::time::sleep(Duration::from_secs(1)).await;

            let client = TcpClient::new(HOST, PORT);
            let client = TcpClient::new_boxed(HOST, PORT);

            client.start().await.unwrap();
            tokio::time::sleep(Duration::from_secs(1)).await;
diff --git a/time/src/client/tcp.rs b/time/src/client/tcp.rs
index b9a7530..bd75f8e 100644
--- a/time/src/client/tcp.rs
+++ b/time/src/client/tcp.rs
@@ -33,7 +33,7 @@ pub struct TcpClient {

impl TcpClient {
    /// Create a new TCP client using the given host and port.
    pub fn new(host: impl ToString, port: u16) -> Box<dyn Client> {
    pub fn new_boxed(host: impl ToString, port: u16) -> Box<dyn Client> {
        Box::new(Self {
            host: host.to_string(),
            port,
diff --git a/time/tests/multiple-tcp-clients.rs b/time/tests/multiple-tcp-clients.rs
index 8c64dbd..6d06834 100644
--- a/time/tests/multiple-tcp-clients.rs
+++ b/time/tests/multiple-tcp-clients.rs
@@ -32,8 +32,8 @@ async fn multiple_tcp_clients() {
            // wait for the binder to be ready
            tokio::time::sleep(Duration::from_secs(1)).await;

            let client1 = TcpClient::new(HOST, PORT);
            let client2 = TcpClient::new(HOST, PORT);
            let client1 = TcpClient::new_boxed(HOST, PORT);
            let client2 = TcpClient::new_boxed(HOST, PORT);

            client1.start().await.unwrap();
            tokio::time::sleep(Duration::from_secs(2)).await;
-- 
2.43.0