Skip to content

Commit

Permalink
refactor: use ToString instead of Into<String> (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
hseeberger authored Nov 29, 2023
1 parent 49425af commit 72fdec7
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
8 changes: 4 additions & 4 deletions eventsourced-nats/src/evt_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ impl Config {
/// Change the `server_addr`.
pub fn with_server_addr<T>(self, server_addr: T) -> Self
where
T: Into<String>,
T: ToString,
{
let server_addr = server_addr.into();
let server_addr = server_addr.to_string();
Self {
server_addr,
..self
Expand All @@ -226,9 +226,9 @@ impl Config {
/// Change the `stream_name`.
pub fn with_stream_name<T>(self, stream_name: T) -> Self
where
T: Into<String>,
T: ToString,
{
let stream_name = stream_name.into();
let stream_name = stream_name.to_string();
Self {
evt_stream_name: stream_name,
..self
Expand Down
8 changes: 4 additions & 4 deletions eventsourced-nats/src/snapshot_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ impl Config {
/// Change the `server_addr`.
pub fn with_server_addr<T>(self, server_addr: T) -> Self
where
T: Into<String>,
T: ToString,
{
let server_addr = server_addr.into();
let server_addr = server_addr.to_string();
Self {
server_addr,
..self
Expand All @@ -185,9 +185,9 @@ impl Config {
/// Change the `bucket`.
pub fn with_bucket<T>(self, bucket: T) -> Self
where
T: Into<String>,
T: ToString,
{
let bucket = bucket.into();
let bucket = bucket.to_string();
Self { bucket, ..self }
}

Expand Down
20 changes: 10 additions & 10 deletions eventsourced-postgres/src/evt_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ impl Config {
/// Change the `host`.
pub fn with_host<T>(self, host: T) -> Self
where
T: Into<String>,
T: ToString,
{
let host = host.into();
let host = host.to_string();
Self { host, ..self }
}

Expand All @@ -366,36 +366,36 @@ impl Config {
/// Change the `user`.
pub fn with_user<T>(self, user: T) -> Self
where
T: Into<String>,
T: ToString,
{
let user = user.into();
let user = user.to_string();
Self { user, ..self }
}

/// Change the `password`.
pub fn with_password<T>(self, password: T) -> Self
where
T: Into<String>,
T: ToString,
{
let password = password.into();
let password = password.to_string();
Self { password, ..self }
}

/// Change the `dbname`.
pub fn with_dbname<T>(self, dbname: T) -> Self
where
T: Into<String>,
T: ToString,
{
let dbname = dbname.into();
let dbname = dbname.to_string();
Self { dbname, ..self }
}

/// Change the `sslmode`.
pub fn with_sslmode<T>(self, sslmode: T) -> Self
where
T: Into<String>,
T: ToString,
{
let sslmode = sslmode.into();
let sslmode = sslmode.to_string();
Self { sslmode, ..self }
}

Expand Down
20 changes: 10 additions & 10 deletions eventsourced-postgres/src/snapshot_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ impl Config {
/// Change the `host`.
pub fn with_host<T>(self, host: T) -> Self
where
T: Into<String>,
T: ToString,
{
let host = host.into();
let host = host.to_string();
Self { host, ..self }
}

Expand All @@ -169,36 +169,36 @@ impl Config {
/// Change the `user`.
pub fn with_user<T>(self, user: T) -> Self
where
T: Into<String>,
T: ToString,
{
let user = user.into();
let user = user.to_string();
Self { user, ..self }
}

/// Change the `password`.
pub fn with_password<T>(self, password: T) -> Self
where
T: Into<String>,
T: ToString,
{
let password = password.into();
let password = password.to_string();
Self { password, ..self }
}

/// Change the `dbname`.
pub fn with_dbname<T>(self, dbname: T) -> Self
where
T: Into<String>,
T: ToString,
{
let dbname = dbname.into();
let dbname = dbname.to_string();
Self { dbname, ..self }
}

/// Change the `sslmode`.
pub fn with_sslmode<T>(self, sslmode: T) -> Self
where
T: Into<String>,
T: ToString,
{
let sslmode = sslmode.into();
let sslmode = sslmode.to_string();
Self { sslmode, ..self }
}

Expand Down
6 changes: 3 additions & 3 deletions eventsourced/src/tagged_evt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ pub trait EvtExt: Sized {
/// Create a [TaggedEvt] with the given tag.
fn with_tag<T>(self, tag: T) -> TaggedEvt<Self>
where
T: Into<String>;
T: ToString;
}

impl<E> EvtExt for E {
fn with_tag<T>(self, tag: T) -> TaggedEvt<E>
where
T: Into<String>,
T: ToString,
{
TaggedEvt {
evt: self,
tag: Some(tag.into()),
tag: Some(tag.to_string()),
}
}
}

0 comments on commit 72fdec7

Please sign in to comment.