Skip to content

Commit

Permalink
drivers: Use clone function over static method
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Sep 16, 2024
1 parent 0d04421 commit 0916009
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/drivers/fake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ impl Driver for FakeSink {
self.stats
.write()
.await
.update_input(Arc::clone(&message))
.update_input(message.clone())
.await;

self.stats
.write()
.await
.update_input(Arc::clone(&message))
.update_input(message.clone())
.await;

for future in self.on_message_input.call_all(Arc::clone(&message)) {
for future in self.on_message_input.call_all(message.clone()) {
if let Err(error) = future.await {
debug!("Dropping message: on_message_input callback returned error: {error:?}");
continue;
Expand Down Expand Up @@ -219,10 +219,10 @@ impl Driver for FakeSource {
self.stats
.write()
.await
.update_output(Arc::clone(&message))
.update_output(message.clone())
.await;

for future in self.on_message_output.call_all(Arc::clone(&message)) {
for future in self.on_message_output.call_all(message.clone()) {
if let Err(error) = future.await {
debug!(
"Dropping message: on_message_input callback returned error: {error:?}"
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ mod tests {
self.stats
.write()
.await
.update_input(Arc::clone(&message))
.update_input(message.clone())
.await;

for future in self.on_message_input.call_all(Arc::clone(&message)) {
for future in self.on_message_input.call_all(message.clone()) {
if let Err(error) = future.await {
debug!(
"Dropping message: on_message_input callback returned error: {error:?}"
Expand Down

0 comments on commit 0916009

Please sign in to comment.