Skip to content

Commit

Permalink
Improve tuple structs suggested by clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernat committed May 21, 2024
1 parent 967e48e commit 0fe4eb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions benches/pub_sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::{Duration, Instant};
use tonari_actor::{Actor, Context, Event, Recipient, System};

#[derive(Debug, Clone)]
struct StringEvent(());
struct StringEvent;

impl Event for StringEvent {}

Expand Down Expand Up @@ -45,7 +45,7 @@ impl Actor for PublisherActor {
PublisherMessage::PublishEvents => {
let start = Instant::now();
for _i in 0..self.iterations {
context.system_handle.publish(StringEvent(()))?;
context.system_handle.publish(StringEvent)?;
}
let elapsed = start.elapsed();

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ mod tests {
#[test]
fn send_constraints() {
#[derive(Default)]
struct LocalActor(());
struct LocalActor;
impl Actor for LocalActor {
type Context = Context<Self::Message>;
type Error = ();
Expand All @@ -1123,10 +1123,10 @@ mod tests {
let mut system = System::new("main");

// Allowable, as the struct will be created on the new thread.
let _ = system.prepare_fn(LocalActor::default).with_default_capacity().spawn().unwrap();
let _ = system.prepare_fn(|| LocalActor).with_default_capacity().spawn().unwrap();

// Allowable, as the struct will be run on the current thread.
system.prepare(LocalActor::default()).with_default_capacity().run_and_block().unwrap();
system.prepare(LocalActor).with_default_capacity().run_and_block().unwrap();

system.shutdown().unwrap();
}
Expand Down

0 comments on commit 0fe4eb6

Please sign in to comment.